Skip to content

How does TraceDock recognise ad blockers?

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.

This is a rather technical blog

Note that this is a rather technical blog. If you have any questions on this topic, feel free to reach out to support@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 Microsoft Edge 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.

TraceDock

Basics: How Google Analytics works

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 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.

TraceDock

Basics: How TraceDock works

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.

If we recognize that Google Analytics is blocked, 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.

How about the users’ privacy?

TraceDock always has the anonymizeIP feature of Google Analytics enabled, and we even anonymize the IP address by blocking out the last octet. This results in forwarding the data with, for example, IP 52.12.23.97 becoming 52.12.23.0. Geo-based analysis is still possible but only on a larger scale.

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 privacyfriendly 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, please reach out to our support team on support@tracedock.com.