td & adblockers

Ad-blockers: How TraceDock recognizes blocked data and how the data is forwarded to Google Analytics

We often get the question of how TraceDock actually works, how we are able to recognize when data is blocked by ad-blockers and how we forward this to Google Analytics. In this blog we’ll explain exactly that. After reading this blog, you will understand how Google Analytics works; how ad-blockers are able to block Google Analytics from receiving data; how TraceDock recognizes ad-blockers and how TraceDock forwards blocked data towards Google Analytics.

Note that this is a rather technical blog. If you have any questions on this topic, feel free to reach out to hello@tracedock.com. We are more than willing to clarify any questions you may have.


How Google Analytics works

To understand how ad-blockers work and how TraceDock solves this, it is useful to understand how Google Analytics works. 

Google Analytics itself is a script that is downloaded from https://www.google-analytics.com/analytics.js. With this script, Google Analytics is initiated in the browser of your client, and fires off events to the google collection point on https://www.google-analytics.com/collect

If you’re using Google Tag Manager, the same process happens but the Google Analytics script is actually loaded from within the Google Tag Manager script.


How ad-blockers work

Ad-blockers and privacy tools are external plugins that can be installed in your browser. Popular ones are uBlock and Ghostery for example. Firefox and Safari already have an ad-blocker installed, and can be turned on in the settings. Both are primarily designed to block advertisements shown on websites, such as display ads or other banners. They do that by black-listing known advertising URLs. Traffic to and from these URLs will be intercepted by the ad blocker and blocked.

A downside to this for website owners is that a lot of blockers have started to block  https://www.google-analytics.com and https://www.googletagmanager.com as well. Meaning that the client is not able to download (and thus, execute) the analytics script. Even if you were able to load in the script (for example by self-hosting the analytics script on your own website), you might be able to initiate Google Analytics, but any events forwarded to this URL will be blocked as well by the ad blockers.

How TraceDock recognizes ad-blockers

You might ask yourself, how can TraceDock recognize if an ad-blocker is active? The key lies in how Google Analytics is initiated.

First off, the TraceDock script runs parallel to the Google Analytics script (this is so we don’t infringe upon any GA settings, making it both easier to setup or deinstall TraceDock if you want to). 

As the TraceDock script is loaded, it will recognize if Google Analytics is set up. Simplified, our method looks at the window constant where a GA instance is loaded, e.g. window.ga (which is defined on windows[‘GoogleAnalyticsObject’]). If window.ga is undefined, google analytics is likely not setup and TraceDock assumes it is blocked. 

We have a few more checks in place to verify if it is a timing issue for quick reloads, a filter for bots that are visiting the site, and some other edge-cases that we stumbled upon while beta testing our solution with our first clients. 

Once we recognize the state of the visitor, we forward any events to the collection point hosted on your own subdomain where TraceDock lives.

How about performance?
If you think that setting up a second script might harm your website’s performance? Be assured, it does not. The TraceDock script is gzipped, 10kb large and due to our blazing fast servers it gets loaded in under 25ms. Your visitors will not notice the difference.


Can TraceDock be blocked?

Often when we explain how TraceDock works, we get the follow-up question: why is TraceDock not blocked?

The short answer is: anything can potentially be blocked by a browser, but it is unlikely that TraceDock itself will be blocked.

The long answer is, we set up a data collection point on your own subdomain. This subdomain is any one of the 1000 most common subdomains such as cms.yourdomain.com, api.yourdomain.com, etc. We set up the DNS of the endpoint to a generic load balancer of Amazon or Google – depending on the cloud provider you choose. The script is minified, uglified and compiled specially for your domain. The name is chosen from a set of common javascript names, such as main.js, run.js, choose.js, cms.js. The same holds for the endpoint. So yes, TraceDock can be blocked, but at the time of writing, it is unlikely. 


How does TraceDock forward the data to Google Analytics?

TraceDock acts as an event round-about, receiving data from your visitors and forwarding them to Google Analytics if an ad-blocker is identified. For debugging purposes, we store the events for 24 hours so that you can access them in the TraceDock portal. Below you see 2 visitors to our website, https://tracedock.com. One visitor had an ad-blocker, and another did not. You can see both events in the live stream, and retrieve more information on the contents if needed.

As you can see in the screenshot, the first visitor was identified to have an ad-blocker. If this happens, we forward the data using the Google Analytics Measurement protocol. This is a “server to server” way of sending data to your Google Analytics account. All session and browser information such as the useragent, path, screen-sizes will be forwarded as well. Next to page views, you can also configure click events and datalayer events for ecommerce or extend basic hit information with custom dimensions and metrics.

The non-blocked traffic also shows up in TraceDock, but because TraceDock recognizes that this traffic actually generated a hit towards google-analytics.com, it decides not to forward the traffic towards Google Analytics (as this would result in double measurement).


How about the users’ privacy?

By default, TraceDock has the anonymizeIP feature of Google Analytics enabled. Besides that, you can configure TraceDock to work as you please. For instance, you could decide not to fire TraceDock if somebody opts out in your privacy preferences. Furthermore, visitors with ad-blockers are not added to the Google audience builder. This means that if you have an ad-blocker we can only analyse your data – anonymously – and not retarget you with downstream ads.

We believe that statistical analytics are essential to creating a great digital user experience. TraceDock enables companies to do just that. 

In conclusion

With this blog we tried to explain how TraceDock works to recognize ad-blockers and forward any blocked data – in a privacy friendly way – to your Google Analytics. We believe that with a growing usage of ad-blockers it is a must to set up first-party analytics to improve your online marketing. Hopefully this will give you some inspiration to set something up yourself or install TraceDock if you don’t want the hassle. 

If you are interested, have more questions or want to see how TraceDock works, request a demo below and we can schedule in a 30-min slot.

Share this post?

Share on facebook
Share on twitter
Share on linkedin

Thank you

We will contact you as soon as possible.