Starbucks is on a roll. The company that provides you with delicious (if pricey) coffee, as well as free Wi-Fi, is trying to provide you with something else — a personal relationship. So far, the company seems to be succeeding.

Many CEOs talk about how social media and digital platforms are the future, and that their companies are adapting in order to take full advantage. However, the reality is that few really understand the intricate triangulation between consumers, a product, and social media, and how the three, when successfully managed, can increase a brand’s profile and generate higher sales. Starbucks appears to be one of the exceptions (a reported nine out of ten people who use Facebook are either fans of Starbucks or know somebody who is).

The real power of social media is that it allows companies to possibly develop new products, and new revenue streams, by observing how customers interact with their product(s) and listening to their feedback, all to a degree that was previously unimaginable. It can also provide new avenues for bi-directional communication and deeper interaction with customers, fostering a closer relationship. An additional benefit is that agile companies can use all of these elements to more easily reposition a brand as a commercial environment changes.

Starbucks, for quite some time now, has been on the cutting edge of incorporating digital marketing and social media into its operations, allowing it to almost seamlessly merge its brick and mortar stores with the numerous digital marketing channels available. The company has also been adept at developing relationships with its customers, using the latest technology and social media platforms. Starbucks is adamant when it says that the purpose of new technology is not just to improve its website or to process payments quicker for people who are waiting in line. It is really about getting in touch with its customers, and trying to better understand them so as to improve service levels and their experience with the brand. As a sign of its commitment, the company has reportedly taken all of the money that it used to spend on traditional media outlets and shifted it into digital and social media marketing.

Starbucks would be considered as being fairly ahead of the curve when it comes to using social media as compared to other companies. “Starbucks was holding Facebook promotions before most restaurants even figured out this was a space they needed to be in,” says Alicia Kelso, an editor-in-chief at Networld Media Group. Starbucks’ first large-scale social media campaign was back in 2009 when it offered U.S. customers a free pastry when they purchased a drink before 10:30 A.M. One million people took advantage of the offer.

When it comes to using digital marketing and social media, there are certain rules of etiquette that should be respected. One important principle would be to engage with your customers on their own terms and to the degree that they want to be engaged with. “Pushing” an ad in this digital age really does not work, especially with the generation known as “millennials” who were basically born into a world of social media. Today, the expectation for many is that they will “invite” a brand or product into their lives, while at the same time actively resisting something that was “forced” upon them. An example of a normally sure-footed company getting this wrong comes from Apple. In 2014, Apple announced that it was making U2’s latest album available for free to users of iTunes. What people did not realize was that the album was also going to be forcibly downloaded to their iPhones and iPods, which many saw as a violation of their privacy. After metaphorically being “thrown under the bus” by Apple, the band’s lead singer Bono was forced to issue an apology. The failed stunt reportedly cost Apple $100 million.

Starbucks, however, is extremely adept at engaging with its customers and fans in that it first gets “permission” before interacting with them. One way it has done this is by developing a huge social media presence involving 50 million people who have agreed to join Starbucks’ communities on such sites as Facebook, YouTube, Twitter, Google+, and Instagram. Another way that Starbucks has managed to get invited into people’s lives is through its mobile payment app (which people must download). This ingenious little app allows people to order and pay for their favorite Chestnut Praline Frappuccino without having to wait in line. It is currently the most popular wallet app in the U.S., with higher usage levels than even PayPal. Once again, in all of the above cases Starbucks has permission, and has even been asked to interact with an audience.

Additionally, Starbucks engages with its customers and builds brand recognition through competitions. For instance, the company put up new advertising posters in six major cities in the U.S. and people had to take a picture of them and Tweet it, with winners receiving a store gift card worth $20. The success of the campaign allowed Starbucks to amplify its message through social media. The value of the interest that it generated was far greater than the actual cost of the promotion. Starbucks stated that the impact of the marketing campaign was “the difference between launching with millions of dollars versus millions of fans.”

In an ingenious example of using social media to execute “ads” in real-time, Starbucks took full advantage of a massive snow storm that hit the Northeastern United States in February of 2013. As temperatures dropped, and the snow started piling up, Starbucks began showing pictures of people holding nice warm mugs of coffee on its social media pages. The ads were formatted in such a way that when people did online searches about the storm, Starbucks’ photos of people drinking coffee would also show up in the results as well.

Another way that Starbucks actively engages with its customers is through its “MyStarbucksIdea.com” site. Here, people can leave their thoughts, ideas, and opinions as to how Starbucks can improve its business. A reported 500,000 people have done just that. The site summarizes all of the ideas and then ranks and clearly presents them according to different categories. As a sign that the company truly listens to its customers, it then tells people which ideas are seriously being thought about and which ideas have already been implemented.

A criticism from some quarters, oddly, is that Starbucks does not update the content of its various social media platforms quickly enough. This is countered with the argument that the company is more concerned with the quality of its content, rather than the quantity or frequency of posts. Maybe this is a good thing. For the most part, Starbucks has been able to avoid any serious controversy from its digital marketing efforts. One small exception would be a Twitter campaign during Christmas of 2012 in the U.K. In it, Starbucks implored people to “spread the cheer.” People who responded implored the company to “pay its taxes” (the company was facing accusations at the time that it was unfairly avoiding U.K. taxes).

Starbucks famously describes its vision of reaching its customers as “one neighborhood, one person and one cup at a time.” It would appear that through the effective use of digital marketing and social media, it is doing just that.