How to measure users that blocked Google Analytics and Google Tag Manager (in a private way)
In this article I will talk about how I managed to, anonymously and privately, measure the number of users who block Google Analytics and Google Tag Manager (GTM).
To measure the number of users we will use a script to grab information (below) and a Google Sheet (below) to record visitor information.
ℹ️ DISCLAIMER: Keep in mind that this article was translated from Portuguese.
With this system you will be able to measure the following metrics of users who block the GTM:
- the number of users who visited your site (estimated)
- the pages visited
- the date of visits
With this you will be able to get an idea of
👀 EXAMPLE: You can see the information of users who blocked GTM from this site here
ℹ️ INFO: Because I don’t want you to waste your time, this system is not a replacement for a Web Analytics tool. It’s just a cookieless way for us to keep track of the number of unique users who are blocking Google Tag Manager when visiting our site.
Table of contents
How Google Analytics and Google Tag Manager Block Measurement System Works
Quickly to understand the mechanics of this system, we’re gonna measure the times that the Google Tag Manager tag is not loaded. Since Google Analytics (and other tags) are inside the GTM container, you can see how many times the tags were blocked.
Subsequently, the system will record the visits of users in a private and cookieless way on a Google sheet. That will allow us to count users/sessions and not every hit.
Here’s how the system works:
- 3 seconds after the script fires, the code will check if Google Tag Manager (GTM) has been blocked (or not loaded for whatever reason)
- If the GTM has been blocked, the script will send the following data to a Google Sheet:
- visit time (aka Timestamp)
- type of browser used in the visit (useragent)
- screen resolution of the user who visited
- website URL visited by user
- Google sheet will gather this collected data and create a hash (a kind of unique identifier for 1 hour) using the information
- Google Sheet organizes information by the number of unique identifiers found online and by the pages viewed.
Here is an example of my Google Sheet with the blocking records (image below):
ℹ️ SOME NOTES FOR GEEKS:
- This model is fallible and, in order to keep the user private, it is possible that the system may generate possible users with the same ID or consider the same user as a different user depending on the time he spends on the site.
- It is possible that you have false positives (users that are not blocking but the system still registers) if your GTM takes a long time to load. <– rare but can happen
- The system does not only register users who lock the system . If the GTM does not load by mistake, for example, that user will also be registered.
- It is possible that Google Tag Manager is triggered but Google Analytics is not.
- The IP of users is purposely not collected
Configure measurement of users that block Google Analytics and Google Tag Manager
⚠️ IMPORTANT: Google Analytics must be installed through Google Tag Manager.
Let’s do it, here’s what you need to do to install this system on your website:
1 Make a copy of the Google Sheet here:
2 Now that you have the Google Sheet, you will have to edit it a bit. Here’s what they have to do:
- go to Tools > Script Editor
- Click on “new Deployment”
- “Execute as: me” and 897 “Who has access: Anyone”
- Authorize all steps as in the image. Do not close the tab to copy the Web App URL later.
- go to Tools > Script Editor
footer of your website.
If you have WordPress, here’s where to go:
4 Finally, you just have to replace in this script
footer the part that says:
by the previously copied Web App URL which will be anything like this: https://script.google.com/macros/s/XXXXXXX/exec
And that’s it.
To test, you can use an Adblocker in your browser or Brave browser and visit your site. Your visit should appear automatically.
Advantages of measuring these users (reason)
With the increase in user privacy (with which I strongly agree even from the perspective of those who work in Web Analytics) it is normal for more and more users to use browsers that prioritize privacy or Adblockers.
Unfortunately, as a Google product, Google Tag Manager or other tag managers may also be blocked in user protections.
This system is a way, while protecting users’ privacy, to be able to perceive the impact of the lack of information.
With this system you will be able to answer the following questions:
- How do I know the number of people blocking Google Analytics on my site?
- How many users arrived at the purchase page with Google Tag Manager being blocked?
- Which tags are being blocked?
- How many users are blocking Google Analytics on my site?
- What percentage of users are blocking Google Analytics on my site?
- Which browsers are blocking Google Tag Manager from firing the most?
Thanks to @thyng for helping to understand when GTM loads and how to measure. Install your Chrome extension if you need to debug GTM. Thank you very much!
Please, look at step 2.4, GIF doesn’t work.
Solved 😉 Thank you!