If you’re a website owner, you’ve probably noticed that some visitors don’t appear in your Google Analytics data. That’s because they’re using adblockers, which block Google Analytics from tracking their activity on your site.
Why prevent Google Analytics blocked by ad blockers?
There are advantages and disadvantages to preventing Google Analytics from being blocked by adblockers. On the one hand, it respects the privacy choice of your visitors and reduces data collection by Google. On the other hand, it means less data for website owners to be used to improve the websites or optimize marketing strategy.
Some people also argue that many install AdBlock without knowing what is being blocked or Google Analytics doesn’t count as ads.
So what’s the best course of action? It depends on your priorities. If you want to respect your visitor’s privacy choices, it’s best to keep it as it is.
What is an AdBlocker?
An adblocker is a piece of software that is designed to block advertising on websites. Adblockers work by preventing the loading of certain elements on a web page, such as banner ads or video ads. There are a variety of adblockers available, and they can be installed as browser extensions or plugins.
Adblockers have become increasingly popular in recent years as internet users have become more aware of the privacy and security risks associated with online advertising. In addition, adblockers can improve website performance by preventing the loading of unwanted content.
How do AdBlockers Work?
There is various type of adblockers, the most common one are extension that can be installed on browsers, and some use ad blocking DNS server. Both work in a similar way, they use a set of filters, which is usually lists of domains that load the advertisements or tracking script.
Extension adblockers such as AdBlock block content that load from a URL which match the domain in the filters and also blocks section in the website based on CSS rules. DNS-based adblockers such as AdGuard block any DNS resolving attempt to match the filters.
Now you understand how adblockers work, there are numerous ways to prevent Google Analytics from being blocked, and there are a few methods that circumvent this by loading tracking scripts from different domains.
There is also a more advanced and costly method, such as using a server-side tag manager. However, in this guide, we will show you a free and much simpler method by using Cloudflare Zaraz.
Setting up Google Analytics on Cloudflare Zaraz
For this method to work, one major requirement is that your website must be proxied via Cloudflare. If you do not currently use Cloudflare, you will have to use other options, such as server-side tag manager, which we will cover in future blog posts.
1. First, go to your website and go to Zaraz->Tools. Then select Google Analytics 4. (Universal Analytics will be deprecated soon, so we will use GA4 instead.)
2. Next, go to Zaraz->Settings, and we will need to change the path where the main script is loaded. This is important because some adblockers block the keyword zaraz which is the default path of loading the script.
3. Verify if it is working properly by visiting your site and checking if the javascript is properly loaded. Or check if your real-time visit shows up on Google Analytics.
Ending Note
This should be a relatively easy and free method to get your Google Analytics 4 to continue collecting data and prevent being blocked. Unfortunately, this solution is only for users already using Cloudflare.
We will make another post to provide other solutions as well, such as setting up server-side Google Tag Manager or using other 3rd party tools to achieve the same results.
Is this too hard for you? If you are a business owner running a critical website, consider hiring us to help maintain your website, we offer website maintenance and hosting services as well as a custom solution for your needs.
If you have any questions feel free to comment below, we read every comment and reply to it!