Unlocking the Mystery of Google Analytics and Advertising

Why do I keep seeing ads about shoes!?

Posted by Albert Cheng on 24 May 2020

Last Updated: 31 May 2020

Google is an advertising company!

We are all quite familiar with Google - we use it in our everyday lives, from Google Maps to finding the nearest coffee shop to Google Search to find where how to make chocolate chip cookies.

But powering all those free services is Google’s paid services, which primarily revolve around analytics and advertising. It is a massive part of Google’s revenue. In fact in 2019, advertising accounted for the majority of Google’s total revenue, which amounted to a total of US$ 134.81 billion!!!

The word on the street is it can cost anywhere between $1 to $200 for a single ad!

So let’s discuss how two of their main services work - Google Analytics and Google Advertising products.

Google Logo Google Google Logo Icon by Icon Mafia on Iconscout

Google Analytics

Google Analytics is a free service that allows website to analyse web traffic, usage and information about site visitors. It provides out of the box analytics, visualisations and metrics that help improve a site’s performance.

You can do things like:

  1. Determine the ‘bounce rate’ of a web page (i.e. how many people visit and then leave)
  2. The average time users spend on a page
  3. The main sources to a webpage (e.g. referrals, Google Search)
  4. Which country has the most visitors to a webpage
  5. The user flow - i.e. how a user clicks through to get to a certain webpage

Example of tracking user flow Powered by Google Analytics

The level of information that is collected depends on how much the website ‘opts-in’:

  1. Basic level - only tracks and analyses user interactions with the site, IP addresses (and geolocation)

  2. Google Advertising Features - a suite of Google services, in particular Remarketing Lists of Search Ads (discussed below)

The more information a website collects from users, the more details their privacy policy must contain.

Basic Level

Before we begin, I’ll talk about what information your web browser reveals about you.

Whenever you visit a website and type in the URL (e.g. https://ayc-data.com), your web browser needs to make a HTTP request to the web servers. This HTTP request will include information about the visitor’s:

  • Browser (e.g. Chrome vs Safari)
  • Device (e.g. PC, Mac, mobile device)
  • IP address
  • Referrer (e.g. whether you came to this site via Google Search or directly)
  • Language (e.g. en-AU, en-US)
  • Screen resolution
  • Font preferences
  • Add-ons
  • Local timezone
  • CPU architecture (e.g. X64)
  • Operating System (e.g. Windows, Mac OS X)

Every time a web page is loaded, it is called a ‘pageview hit’ and information about the page itself, plus two things that will happen:

  1. GA Javascript code (analytics.js) collects information from the above HTTP request and sends it back to GA’s servers (in the form of a list of parameters attached to a single invisible tracking pixel)

  2. GA will store an unique identifier cookie in the user’s web browser so it can determine whether it is the same user revisiting the webpage or a new user. However, it only identifies unique users across one browser/device, and cannot uniquely identify users across different browsers or devices. By default, this cookie is stored for 2 years, but is refreshed every time the user revisits the website.

There are legitimate reasons for needing the above data - for example, if most of the users visit a website via a mobile device, the web page needs to be responsive and display properly on a small screen.

Prohibiting Fingerprinting and No-advertising

Before I continue, I’ll need to discuss a bit about what digital fingerprinting is.

Digital fingerprinting is using information about a user’s device and browser to identify and profile a user. Some types of fingerprinting include:

  1. Browser/Device fingerprinting - collects information about your web browser (e.g. browser type, screen resolution, etc.), similiar to the method described above with the HTTP headers

  2. Canvas fingerprinting - This involves requesting the user’s web browser to render a hidden image (hence they name ‘canvas’). During the process of rendering, the user’s device sends information about its GPU model, operating system, system performance and other things that create a very unique profile of the device.

Fingerprinting is commonly used by advertising to determine a user profile based on their Internet surfing habits, but it is also used by banks for fraud detection. For example if a hacker logs into your bank account that isn’t you, fingerprinting will help identify that hacker isn’t you.

If you’re curious to see an example of fingerprinting, the website https://amiunique.org/ is a great way to see how unique your device/browser is.

For example, for my device, my HTTP header alone already makes me very unique!

HTTP Headers Fingerprints Example of my Device Fingerprint Uses https://amiunique.org/

There is a difference between ‘active’ fingerprinting and ‘passive’ fingerprinting. Passive fingerprinting happens all the time, for example, for a website to know whether you are from Australia. However, active fingerprinting involves the website storing this information permanently and creating a profile of you. This profile stays even if the user deletes their cookies from the web browser. That is, if you visited a website, deleted your cookies and revisited the website, the website could still use its stored fingerprint to identify it is you.

Google Analytics expressly prohibits the use of device and canvas fingerprinting techniques for measurement in advertising, unless the user is able to reset these identifiers from their own device. In other words, active fingerprinting is not allowed. Furthermore, IP addresses can be masked so Google Analytics uses only a portion of the IP address (to make it difficult to exactly pinpoint the user’s location).

Google states that unless a website opts into the advertising features, the data will not be used for advertising purposes.

The data collected by Google Analytics is stored and managed by Google, which uses Google Cloud Platform (the same platform that powers YouTube, Google Maps, etc.).

Google Cloud Platform

Google Analytics has a good overview of how the above all works here.

Google Analytics Advertising Features

If a website has enabled GA Advertising Features, a third-party DoubleClick cookie is used to send data to GA servers to enable remarketing for products like Google Ads.

When a user’s behavior meets the criteria the website has specified, a cookie is sent to ID that user. In the future, when the user visits the same site, Google Search or any site on the Google Display Network (I’ll explain what this network is below), they might see ads targeted to them due to their behaviour.

An example of remarketing is provided by Google:

GA Advertising Example From Google Analytics - About remarketing audiences in Analytics

Google Analytics only lets websites see details about your user demographics (e.g. gender, age, preferences, etc.) if the website opt into Advertising Features. As part of this deal, the website has to be part of the user data collection process.

Basically the cookie helps ‘profile’ the users that will help tailor Google Ads determine advertising audiences based on user behavior on the site.

Targeted Advertising and Advertising Cookies

Targeted advertising is the opposite of ‘blanket’ advertising - instead of advertising to everyone, the advertiser specifies the specific target audience or ‘reach’:

  1. Certain people - e.g. people who recently bought shoes, people in an age bracket, people from a certain region

  2. Certain moments - e.g. people that search for specific keywords, people Your targeting options

Google provides an automatic targeting features that optimises the above for advertisers (as part of their advertising service). Targeted advertising is achieved by Google Ads in four main ways:

  1. Contextual targeting - Google analyses the publisher’s website to determine what ad best suits it

  2. Placement targeting - advertisers can put specific placements on the publisher’s website to show the ad (e.g. the header only)

  3. Personalized targeting - advertisers can customise ads to target based on personal preferences (e.g. only target users who live in the UK, are female, and recently bought perfume)

  4. Run of Network targeting - advertisers can advertise everywhere in all of Google’s offerings

Advertising cookies are sent and stored on a user’s web browser whenever a user visits a website with Google Ads. When the webpage serves the ad, it also sends the cookie to the user’s web browser too.

However, an advertising cookie can also be created if the webpage opts-in to send user data to Google for advertising purposes. An example is mentioned above with Google Analytics Advertising Features.

To help track how well these ads are doing, conversion cookies are stored to help determine which ads were clicked through and ultimately converted to a sale. These conversion metrics are provided to advertisers through the Google Marketing Platform.

Cookies Cookies - sadly advertising ones aren’t edible Image by Steve Buissinne from Pixabay

How Google says Targeting works

Google has identified a few examples of how advertising cookies are used:

  1. select advertising based on what’s relevant to a user

  2. improve reporting on campaign performance (so advertisers can see how well their ads are doing)

  3. record the user’s previous interactions with an ad to avoid showing ads that the user has already seen

  4. remember a user’s most recent searches to help select advertising - e.g. a user visited sports websites, so sports ads are displayed

  5. remember which devices the user has used to visit websites to give a consistent user experience across all devices (provided they haved signed into their Google account)

Google has expressly stated factors that are used to tailor/target an advertising to a user:

  1. Google Account information (e.g. age, gender)

  2. User’s general location based off their IP address

  3. Google Search query

  4. Previous Google Search activity

  5. User’s browser activity while they were signed in to Google

  6. User’s previous interactions with ads

  7. Types of websites the user visit

  8. Types of mobile app activity on the user’s device

  9. User’s activity on another device

  10. Time of day (e.g. ads for food at lunch time)

  11. Other info the user gave to an advertiser (e.g. email subscription to a newsletter)

Over time, the advertising cookies paint a pretty good picture of the user’s habits - analogous to seeing a person walk through a shopping mall and seeing which shops they visit. If they are always browsing in clothing stores, there’s a good chance they may buy some clothes!

Google has summarised how advertising works in a nutshell:

You may see ads for products you previously viewed. Let’s suppose you visit a website that sells golf clubs, but you don’t buy those clubs on your first visit. The website owner might want to encourage you to return and complete your purchase. Google offers services that let website operators target their ads to people who visited their pages.

For this to work, Google either reads a cookie that’s already in your browser or places a cookie in your browser when you visit the golfing site (assuming your browser lets this happen).

When you visit another site that works with Google, which may have nothing to do with golfing, you might see an ad for those golf clubs. That’s because your browser sends Google the same cookie. In turn, we may use that cookie to serve you an ad that could encourage you to buy those golf clubs.

Your visit to the golfing site may also be used by Google to show you personalized ads when you later search for golf clubs on Google.

How do I know whether tracking or advertising cookies are being used?

If you install an extension, such as Ghostery, you can see what tracking cookies/technologies are being used on the website.

At a high-level:

  • If you see https://www.google-analytics.com/ - this is Google Analytics basic features

  • If you see http://stats.g.doubleclick.net/ - this is Google Analytics Advertising features

Magnifying Glass Tracking, Google Tracking Image by bluebudgie from Pixabay

Google Advertising (Google Ads)

Google Ads is a paid advertising platform and service that uses ‘pay-per-click’ (PPC) advertising. That is, the advertiser only pays when a user clicks on the ad.

I’ll focus on two main types of ads (and not worry about Note video ads on YouTube for this blog to make it easier to explain):

  1. Search ads - text ads that are displayed among search results on a Google results page or pop up in Google Maps

  2. Display ads - image-based and are shown on web pages within the Google Display Network.

FYI - before 2018, Google Ads had different terms/products:

  1. ads on Google Search were called ‘Google AdWords’
  2. ads on Google Ad Exchange were called ‘DoubleClick’

Google Ads is an entirely automated auction bidding system for advertising:

  • Buyers - i.e. the advertisers
  • Sellers - i.e. the publishers

Every time a potential ad slot pops up, an auction occurs and the best bid wins the slot. The auction is entirely automated and all done real-time whenever a user visits the website. That means, every time you visit a page where a Google ad has popped up, a real-time auction (or within 100 milliseconds) has happened behind the scenes!

The winning bid is determined by the Advertiser’s ‘AdRank’, which takes into account many factors, such as:

  1. Bid amount - how much the advertiser is winning to pay for the ad slot

  2. Quality score - based on the quality and relevance of the ad (measured by how many people click on it)

  3. Reserve bid price - minimum reserve price of the ad slot

  4. Context of the user’s search/visit - e.g. the person’s location, device, time of search, search keywords etc.

Bidding preferences can be either set by Google or by the advertiser:

  • Google can take care of the bid prices based on competitors, preferences etc.
  • The advertiser can also provide their own automated algorithm to refine targets, ROIs and budgets - e.g. a buyer may only be willing to pay $2.00 for a slot so they set a budget cap of $2.00.

Bid types include:

Auction Auctions, but you don’t actually need a gavel Image by 3D Animation Production Company from Pixabay

Types of Google Ads services

Google’s three main advertising services are:

  1. Google Ads (for advertisers)

  2. Google AdSense (for publishers)

  3. Google Ad Exchange (AdX) (for advertiser and publishers) (formerly known as DoubleClick Ad Exchange)

  4. Google Ad Manager

Google Ads lets advertisers display ads that may appear in either:

  1. Google.com - e.g. Google Maps searches

  2. Google Search Network - i.e. on Search Engine Results Pages (SERP), formerly known as ‘Google AdWords’

  3. Website within Google’s Display Network (GDN)

Google AdSense essentially allows websites sign-up and become part of the Google Display Network. Once they are signed up, they allow spaces on their webpages for Google Ads (i.e. ad ‘slots’). Ads may be either text-based or images-based, for example, text or image ads in Google Shopping.

There are million of websites currently in the Google Display Network.

Google AdSense has 3 steps:

  1. Publisher/website makes their ad spaces available
  2. The highest paying ads appear on the website
  3. Publisher gets paid

As explained above, the ads are sold in a real-time auction.

Google Search Engine Every search is a potential ad slot! Image by Photo Mix from Pixabay

Google AdX, like GOogle AdSense, is also a programmatic online auction marketplace for advertisers and publishers. However, the main difference is advertisers go through intermediaries - companies which provide advertising platform services and are analogous to brokers for a stock market. You don’t buy shares directly from the market, but through a broker.

Unlike Google AdSense, there’s minimum requirements for publishers to meets (e.g. they need a few million webpage visits per month). The main publishers are generally large news sites or other sites with a huge amount of traffic. Furthermore, Google AdX may include publishers/websites that aren’t part of the Google Display Network but otherwise want to sell ad slots on their website.

Google AdX gives more control to publishers on how the ads will look like and gives a better them portion of the advertising revenue. For advertisers, they go through intermediaries and get the benefit ofs millions of ads per day without the excess overhead.

Like Google AdSense, real-time bidding is done for each ad slot.

Closing Thoughts

I hope this article gives you an idea of how Google tracks you and what happens behind the scenes!

So the next time an ad pops up about shoes, I’ll at least know how much behind the scenes stuff to get there. The ad may also reflect my life choices too…