Ad Blockers, a thorn in the side of every online business. Wouldn’t it be great if we could bypass those Ad Blockers and keep our Google Analytics data accurate?
That’s what Steve from Its420somewhere.com thought, when he contacted me with a well-researched feature request for CAOS. A stealth mode to bypass (most) ad blockers. Today I’ll show you the base principles of bypassing Ad Blockers and protecting your Google Analytics data with CAOS.
Why should I bypass ad blockers?
Before we dive into the how’s, the why might be a better place to start.
We can all agree that trustworthy analytics data is key for any online business. You, a business/blog owner, want to know your customer/visitor.
I respect the choice to use an ad blocker on the internet. I use it too. To protect my privacy, but more importantly, to protect my system. Advertisements are often injected with malware. That’s one of the reasons why I removed the advertisements on this site a few months ago. To protect you, my guest.
Then isn’t it a dangerous practice to bypass ad blockers? In case of advertisements and/or malware, yes. In case of Google Analytics, no. As long as it is used responsibly. This means:
- You still have to use a Cookie Notice, if you’re planning to collect data that can identify an individual within the EU, or
- configure Google Analytics to respect GDPR laws, or
- notify your visitor that you’re using cookies to collect data.
How does an Ad Blocker work?
Each ad blocker uses a different approach.
In earlier versions, CAOS already circumvented the easier ad blockers, since they’d only block files loaded from google-analytics.com. Hosting analytics.js locally resolved that.
Nowadays most ad blockers (including the tracking protection built into browsers) will simply block all requests made to blacklisted domains, such as google-analytics.com, while some extensions block files ‘intelligently’ — based on the content of a file.
We can work around the first approach with relative ease, while attempting to crack the latter means crossing some serious ethical boundaries.
How to Sneak your Data past Security
It’s starting to sound like I’m teaching you how to smuggle USB sticks across the border. You wish! But while we’re on the subject: peanutbutter.
Most ad blockers block all requests to blacklisted domains. This is exactly where its weakness lies. It can’t (and shouldn’t) block requests to the current domain, because that would cause some serious errors — rendering the ad blocker itself unusable.
Exploiting this weakness is best explained using this stunning illustration, made by yours truly — autographs after the show, please:
Usually, the webpage instructs the browser to make a request to google-analytics.com/collect?a=1&b=2&etc=etc. The ad blocker ‘sees’ this request and says: nuh-uh!
To bypass the Ad Blocker, we need to send Google Analytics’ data through the server hosting the website. We instruct the browser to make a request to yourdomain.com/collect?a=1&b=2&etc=etc and that request is proxied to Google Analytics — through the backdoor, so to speak — where the ad blocker is not present.
Prevent Ad Blockers from Blocking Google Analytics Data with CAOS
At this point, you must — you should, actually — be thinking: what an amazing idea — and an even more amazing person! How do I get my hands on this?
Well, If you’re already using CAOS, you might’ve noticed the new Stealth Mode in the plugin’s settings.
Since v2.7.0 CAOS is officially the only Google Analytics plugin for WordPress with a Stealth Mode feature, allowing you to bypass ad blockers and browser built-in tracking protection, preserving your precious Google Analytics data.
Stealth Mode can also be used in compatibility mode. This means that you can use it in Monster Insights, WooCommerce GA Integration and other GA plugins — and it’s completely free! Go ahead, download it now!