Over the last decade, e-commerce has imposed a painful profit squeeze on big-box retailers, resulting in layoffs, store closings, mall reconfigurations, and even bankruptcies. With no reprieve in sight for retailers, the online world is poised to do the same to brand-name consumer products companies.

One of the core reasons that this is happening is that in addition to providing always-on, on-demand convenience, online retailers know so much more about their customers than their offline counterparts do. In fact, they have mastered the art of creating a direct connection to their customers, which in turn allows them to collect massive amounts of data about them. Then, by applying tools like artificial intelligence, the online retailers are able to create more-personalized customer experiences, fostering levels of satisfaction, connection, and customer loyalty that traditional retailers just can’t compete with.

And when it comes to consumer goods companies, that same artificial intelligence is also capable of serving up recommendations for a white-labeled product versus a name-brand one, putting greater pressure on branded consumer staples companies. In fact, the stock market already recognizes this; the sector has declined 13% year-to-date (in comparison, the S&P 500 has seen a 2% gain). Further illustrating this point, Procter & Gamble (P&G) just posted another lackluster earnings report — which, not coincidentally, was blamed partly on declining sales and margin pressure from those same big-box retailers. While rising costs also seem to be eating into margins, the growing market share of online retail with more-sophisticated customer engagement digital models is still a threat the consumer staples companies haven’t dealt with effectively.

Amazon Prime is now the gold standard for one-to-one customer marketing at scale, thanks to innovations in machine learning and an undeterred commitment to service. At the same time, Alexa, Amazon’s digital assistant, is rapidly becoming an arbiter of brand choice, with half of searches on the web projected to be done with voice in the next five years (according to Sebastien Szczepaniak, a former Amazon executive who now heads e-commerce for Nestlé). As another channel for direct communication with customers, Alexa not only makes the shopping experience easier but also serves as another vehicle for data collection, creating an endless feedback loop of customer service, ever-better recommendations, and on-demand purchases.

While it used to be the case that Amazon’s customers did buy on price, and often compared prices, the retailer now delivers such great customer engagement that it’s extremely difficult for offline players to even attempt to match the magnitude and depth of Amazon’s always-on, personalized experience, and the judicious use of AI to make it come alive. It should come as no surprise that P&G has cut $200 million from its digital advertising budget this year when it became clear that the ads were not resonating with consumers — in fact, the average view time for a mobile ad appearing in a news feed on platforms such as Facebookwas only 1.7 seconds.

What digital marketing claimed to provide — real-time visibility into the customer, plus better conversion rates — isn’t on offer from any agency or brand, but Amazon has it mastered. The company has effectively created a new model for what digital marketing should actually look like: a one-on-one relationship with the customer, informed by data collection, optimized with machine learning, and nurtured with other forms of AI.

How does an offline player, in this case a consumer packaged goods company, hope to catch up? It’s possible, but it requires a difficult journey.

The first decision for branded companies looking to emulate Amazon Prime is creating an on-demand, always-on direct connection with their customers with a conversational interface. Amazon has always had this by virtue of being online (like Uber, Lyft, and Netflix), but the offline world needs that as a necessary lynchpin for creating a customer-focused, data-driven, real-time business. Tools that allow this now exist, fostering a direct connection for brands through messaging and two-way conversational AI. Consider Pypestream, a customer engagement solution that enables direct-to-consumer, two-way persistent connection (through a dedicated platform, built only for your customers and employees to engage with you), as well as AI-backed conversational experiences. And Gravy Analytics, which augments data to provide real-world, location-based intelligence, using verified consumer attendance at places and events across the U.S. (Disclosure: I am an investor in both of these companies), as well as other advanced AI tools provided by IBM’s Watson, Google, and Microsoft.

Creating the right use case to motivate customers to then engage with the brand with these tools is the second step. Automation of mundane inquiries (“Would you like to order more diapers?”), a new loyalty program that rewards usage in some meaningful way (two-way messaging to immediately recognize a customer’s purchase and then share an offer for the next one), and even making complex tasks easier (such as filing an insurance claim through a conversational interface) are just a few examples of high-value offers designed to prompt a deeper customer relationship. Others include paying a bill, changing a password, choosing seats for an opera performance, or changing a flight.

Then, the name of the game is to accumulate more and more relevant data on target customers — but this must be done with privacy and trust at the forefront. Recent regulations like the EU’s General Data Protection Regulation (GDPR) are now bringing making this issue top of mind for marketers, and the importance of compliance will be requisite. Some data will come from marketers’ growing knowledge of their customers’ consumption patterns, but there are also significant new data sources never before available in the offline world. For instance, opt-in customer behavior for hundreds of millions of mobile phones covering locations and events worldwide is now available offline. There exist services that compile data based on location that can then be layered on top of the brand’s existing data.

Finally there is the application of advanced AI-like machine learning to complete the journey toward the type of deep customer engagement and insights that Amazon Prime has pioneered today.

This is a call to action for consumer staples CEOs, who, like the big-box retailers before them, are ill-prepared to compete with Amazon Prime and the one-to-one personal assistant and customer engagement engines it employs, like Alexa. But it’s not all doom and gloom for consumer brands: The U.S. Census Bureau recently reported that 80% of retail sales still happen in the offline realm. The tools exist to enable them to act quickly to develop their own direct, sustained relationships with their consumers to foster continued customer loyalty. But if consumer brands don’t act soon, they risk being the next set of offline businesses to fade in relevance.

Originally published in Harvard Business Review.