The front desk of the Amazon office is pictured in New York, May 1, 2019. Carlo Allegri | Reuters

If you were browsing Amazon in search of deals for Prime Day, you undoubtedly came across a lot of ads. That's because Amazon has a trove of information about buying habits that makes it a valuable place for advertisers. Think about it: Amazon knows the last time you bought toothpaste on the site and which brand you typically like to buy. Advertisers can use that information to try to get you to buy their brand of toothpaste right when you're running low. Other advertisers can use Amazon to target ads, even if they're selling products that you can't necessarily buy on Amazon, like insurance or a car. These advertisers can use Amazon's extensive customer data to figure out who might buy their product or services, and they can use Amazon's ad products to reach those people, both on Amazon's properties and through a network of third-party sites. This rich trove of data has made Amazon into the third-largest digital ad platform in the U.S. and a growing contender to take on the digital ad duopoly of Google and Facebook. Earlier this year, eMarketer said it expected Amazon to claim 8.8% of U.S. digital ad spend in 2019, up from 6.8% in 2018, while expecting Google to drop from 38.2% to 37.2%. Meanwhile, Facebook was expected to pull 22.1% of digital ad spend in 2019, up very slightly from 21.8%. Amazon's net sales in its "other" category, which consists primarily of advertising sales, was $2.72 billion in the first quarter. In September, the company simplified its branding, bringing together areas like Amazon Media Group, Amazon Marketing Services and Amazon Advertising Platform under the name "Amazon Advertising." Amazon's ad boss, Paul Kotas, said at the time that the move was meant to make the company's ad options "simple and intuitive for the hundreds of thousands of advertisers who use our products to help grow their business." Even with this move, Amazon's ad business is complicated and can be hard for people outside the industry to understand. Here's how Amazon sells ads, and why it has a natural edge over Google and Facebook in some areas.

Sponsored ads

Do a product search on Amazon, and you'll likely notice products with a little "sponsored" label. These are "sponsored products," or keyword-targeted ads that let advertisers promote certain products. Here, advertisers bid on particular terms, and ads with higher bids are more likely to be displayed. Advertisers pay only when their ad is clicked, and they set the maximum amount they're willing to pay. This is similar to how search ads work on Google. These ads can show up above, near or within search results, or even on product detail pages. This is "the simplest way to start advertising," Amazon says on its advertiser-facing website. This is one reason when you're searching for a certain brand of product like "Clinique lipstick," you might see non-Clinique products show up first. In a test search on Monday, CNBC saw L'Oreal, Maybelline and Luscious Cosmetics products before a single Clinique product — the first non-sponsored product on the page. This is what some advertisers call "conquesting," or buying ads against search terms for rival products. It's a way for Maybelline, for example, to try to get in front of someone looking to browse Dior lipsticks.

A Maybelline Lipstick shows up first after searching for "Christian Dior lipstick" Megan Graham | CNBC

Advertisers can also buy "sponsored brands" listings, which appear in search results to help consumers discover a given brand. For instance, say you search for the term "water bottle" on the site. A brand like Perrier can appear in the top section of the search results to showcase its logo, some writing and a few products. If a customer clicks in that area, they'll be taken to a product detail page or a customized landing page for that brand. Like sponsored results, this advertising is sold through a cost-per-click, auction-based pricing model -- the higher the bid, the more likely the ad is to be displayed.

Amazon's "Sponsored Brands" Megan Graham | CNBC

One upside of these kinds of ads is they don't really look like ads to the untrained eye. Goat Consulting, a consulting firm that focuses on brands selling on Amazon, recently did a survey of more than 2,000 Amazon users to see whether they were aware of the difference between organic product display and advertised product display. About half of them said no, said the firm's chief marketing officer, Will Tjernlund. "People don't even realize they're being advertised to on Amazon," he said. In addition, the buying data from Amazon is so detailed that marketers can save their dollars and not advertise to people who just bought a product and aren't going to be buying it again soon. Rahil Berani, vice president and director of programmatic at Digitas North America, said for items that can be bought repetitively, advertisers can suppress people who have recently purchased that product since they won't be in the market for more right away. Once some time has passed and they might be running low, advertisers can ramp up spend again.

Other ad types and Amazon DSP

Amazon also sells "display ads," which are image ads that could show up as you shop on Amazon or on your Kindle, or as you read an article on a third-party website.

Amazon Display ads Via Amazon.com

There are also video ads, which are pretty self-explanatory. They appear in video content across Amazon sites (including IMDb), as well as on Amazon devices like Fire TV.

An example of an Amazon video ad. Megan Graham | CNBC

Display and video ads don't necessarily have to be for products sold on Amazon, and can appear both on Amazon and on sites and apps from third parties. For instance, let's say you're a bathroom repairman. You might like the information Amazon has to target people who are buying things like grout and hammers. But you can't sell your repair services directly on Amazon. So Amazon lets you use its data to target the same kinds of customers, both on its site and on other sites. To reach consumers on third-party sites, advertisers can use something called a "DSP," or a "demand-side platform." Amazon has its own, called — you guessed it — Amazon DSP. In simple terms, the advertisers figure out what audiences they'd like to reach, then can use the service to reach those people across multiple sites automatically (or "programmatically," in industry jargon). Amazon says the product is "best suited to advertisers who want to programmatically buy display and video ads at scale." Amazon lets advertisers very easily see how well their media spend is translating to actual sales using the DSP. Many other e-commerce companies with similar offerings, like Walmart and Target, do not, said Digitas' Berani. "You're essentially going to have to put the investment into them and let them do it," Berani said.

What's next for Amazon ads