Amazon Knows What You Buy. And It’s Building a Big Ad Business From It.

SEATTLE — When a chain of physical therapy centers wanted new patients, it aimed online ads at people near its offices who had bought knee braces recently on Amazon.

When a financial services provider wanted to promote its retirement advisory business, it directed ads to people in their 40s and 50s who had recently ordered a personal finance book from Amazon.

And when a major credit card company wanted new customers, it targeted people who used cards from other banks on the retail site.

The advertisers found those people by using Amazon’s advertising services, which leverage what the company knows better than anyone: consumers’ online buying habits.

“Amazon has really straightforward database — they know what I buy,” said Daniel Knijnik, co-founder of Quartile Digital, an Amazon-focused ad agency that oversaw the ads for the clinics and retirement services. “For an advertiser, that’s a dream.”

Ads sold by Amazon, once a limited offering at the company, can now be considered a third major pillar of its business, along with e-commerce and cloud computing. Amazon’s advertising business is worth about $125 billion, more than Nike or IBM, Morgan Stanley estimates. At its core are ads placed on Amazon.com by makers of toilet paper or soap that want to appear near product search results on the site.

But many ad agencies are particularly excited by another area of advertising that is less obvious to many consumers. The company has been steadily expanding its business of selling video or display ads — the square and rectangular ads on sites across the web — and gaining ground on the industry leaders, Google and Facebook.

In addition to knowing what people buy, Amazon also knows where people live, because they provide delivery addresses, and which credit cards they use. It knows how old their children are from their baby registries, and who has a cold, right now, from cough syrup ordered for two-hour delivery. And the company has been expanding a self-service option for ad agencies and brands to take advantage of its data on shoppers.

“That is where the insane scale can happen for the business,” said John Denny, a vice president at CAVU Venture Partners, which invests in consumer brands like Bulletproof coffee and Hippeas chickpea puffs.

Major online ad networks offer different ways to target customers. A brand that sells running shirts for women might turn to Google to find people who the company believes are female and interested in running based on their search and browsing history. The company may turn to Facebook for people in a women’s running group.

Many of Amazon’s features are similar to those of Google or Facebook, like offering ways to target users based on their interests, searches and demographics. But Amazon’s ad system can also remove a lot of the guesswork by showing ads to people who have bought the shirts on Amazon.com.

Advertisers have long run some targeted campaigns through Amazon’s ad network. Many have done that by working directly with Amazon’s staff, who would place their orders on their behalf. That option has historically been focused on larger brands because it requires a minimum advertising commitment. Over time, Amazon has given more advertisers and their agencies access to the self-service system to run their own targeting campaigns on and off Amazon’s websites, and at a variety of spending levels.

Users of the self-service system can choose from hundreds of automated audience segments. Some of Amazon’s targeting capabilities are dependent on shopping behaviors, such as “International Market Grocery Shopper” and people who have bought “Acne Treatments” in the past month, or household demographics, such as “Presence of children aged 4-6.” Others are based on the media people consume on Amazon, such as “Denzel Washington Fans” or people who have recently streamed fitness and exercise videos on Amazon. The company declined to comment.

Just the Cheese, a brand run by Specialty Cheese Company in Reeseville, Wis., makes crunchy dried cheese bars that have taken off as a low-carb snack. By using algorithms to analyze how Just the Cheese’s search ads performed on Amazon’s site, the ad agency Quartile Digital noticed that people who searched for keto snacks and cauliflower pizza crust, both low-carb diet trends, also bought a lot of cheese bars. So Quartile ran display ads across the web targeting Amazon customers who had bought those two specific product categories. Over three months, Amazon showed the ads on websites more than six million times, which resulted in almost 22,000 clicks and more than 4,000 orders.

That 20 percent conversion rate — a sale to one out of five people who clicked on the ads — was “amazing,” Mr. Knijnik said. “That is the kind of powerful granularity for building the target audiences that just Amazon can give you.”

Like other ad networks, Amazon uses cookies and other technical tools to track customers from its site onto other websites. They let the company know that a person who recently bought a diet book is now reading news on CNN and could be targeted on that site with an ad for a protein bar. Amazon does not tell the advertisers who that user is, but it does serve her ads on the brand’s behalf.

Last year, Amazon released a tool similar to those used by some other ad networks. That tool embeds a piece of computer code known as a pixel in ads shown on other sites, and tracks how that particular ad placement leads to customers viewing a product on Amazon or buying it outright.

“They want more branding dollars, those TV dollars; that is really part of the reason they launched that advertising attribution data,” said Melissa Burdick, who worked on Amazon’s ad teams before leaving to found Pacvue, which provides tools for brands to optimize Amazon ads.

Aside from shopping habits, consumers give Amazon other information that it uses to aim ads. For example, Amazon’s website has a section called “Garage,” where customers can submit their car’s make and model information to make sure they buy parts that fit. In 2015, Amazon used Garage data to help an auto insurer target specific customers, according to a case study on its site. Now, on their own, brands can choose to show ads to drivers who have an Acura MDX as opposed to people who have an Acura TL via Amazon’s ad portal.

Amazon has slowly been developing ways for brands to target their own customers and shoppers, like other ad networks have offered for a while. Advertisers can upload their own customer lists, which Amazon matches with its database, and then show ads to those customers, or other people Amazon’s algorithms determine are similar.

Mr. Denny of CAVU Venture Partners pointed to one of his firm’s investments, One Brands, which sells protein bars on Amazon. The company can retarget customers who looked at the product page for its birthday cake-flavored bars, as well as so-called look-alike audiences that lets One Brands find consumers whose shopping behavior Amazon has determined is similar to people who have bought the bars before.

It not only finds those customers, but Amazon automatically shows different ads to different people based on their shopping behavior. People who do a lot of research on products may see an ad that features positive product reviews, whereas those who have signed up for regular deliveries of other products in the past might see an ad offering a discount for those who “Subscribe & Save.”

“Early tests are showing this is insanely powerful,” Mr. Denny said. “They can do this and nobody else can come close.”