Google expands ad tracking in the real world

Google Lens makes your camera smarter than you
Google Lens makes your camera smarter than you

Next time you see an ad on Google, the company might be able to tell if you went out and bought it in a brick-and-mortar store.

A new Google (GOOG) feature can tell when someone who clicked on an ad in search results made a credit or debit card purchase at a corresponding physical store. The tool will give advertisers a better idea of how successful their online ad campaigns are.

How does Google know if you bought something at Subway or Aldo? It works with the credit and debit card companies to match up in-store purchases with your online identity. The company has partnerships with companies that account for 70% of credit and debit card purchases in the U.S.

Related: Google fights to win back advertisers

The credit card companies provide Google with encrypted information about purchases, which Google software then compares to Google profiles of people who viewed relevant ads. Google cannot actually see any of the encrypted data, so it does not have access to identifiable payment information, like the person's name or what they bought.

The matches are tallied up in aggregate to protect privacy. That means Google can tell a restaurant their ads resulted in 1,000 people going there to eat and how much they spent, but not share any personal information about individual diners.

For all its futuristic investments like self-driving cars, internet-beaming balloons and thermostats, Google is still an advertising company. It relies on ad sales for the majority of its revenue. Last quarter, ads made up $21.4 billion of Alphabet's $24.8 billion in sales. Making the connection between online ads and in-person purchases could be huge for the company, which is competing against companies like Facebook (FB) for the same ad buyers.

Related: Google starts to prove it's not just a one-trick pony

Google is also adding another real-world tool to get more customers into physical stores. It will show information for local stores on YouTube ads, such as hours and driving directions to the nearest store or chain location. In order to know what stores you're close to, YouTube will rely on information from your location history. The company has been using this feature on Search and Maps since 2014.

Google announced the tools on Tuesday at its annual advertising and marketing conference in San Francisco. The YouTube feature is well timed. Earlier this year, some advertisers pulled out of YouTube ads after they were shown alongside extremist videos.

If the idea of Google tracking real world purchases, even in aggregate, unsettles you, there are ways to opt out. You can log out of your Google Account before using search, or turn off your search history so that it's not saved. You can also use cash to buy your frosty and fries.

For the local ad information tool, you can turn off your location history.

CNNMoney Sponsors