how-to implement track ad blocking with google analytics

1. Ad block: #wth 
The reason you might think I was being sarcastic above is that there is such venom in the media (of course the media!) about people who use ad blockers, and an incredible amount of hoopla around how the only reason media is dying is the awful people using ad blockers in their web browsers.
The reality is not quite that cut and dry.
First, plant me firmly in the column of people who believe that using an ad blocker is a personal choice, each person makes the moral decision they are most comfortable with. Second, I believe that the let me make cheap money by spraying and praying some of the most awful intelligent-deficient ads in large numbers is a contributing factors to users wanting to use ad blockers. Third, the profound lack of empathy for the user experience, especially on mobile, is another huge contributing factor.
If you are getting the feeling that I'm holding publishers, large and medium companies with large people, platforms and budgets to do more in this debate, you would be right. I am not excusing the users (see above, and more below).
Let me make this real for you, by looking at two specific examples.
2. Technical how-to implement enhanced code guidance (Google Tag Manager or direct)
Tracking ad blocking behavior is quite simple.
If you have implemented analytics.js, via the standard recommended approaches, you can use the strategy below to simply update the code on your website manually. The code defines a simple plugin and then requires that plugin, passing it the custom dimension index that you'll create to capture ad blocking status.
All you need to do is make sure you replace the two bits in the red…
adblock analyticsjs tracking avinash
I don't trust WordPress to render code cleanly, always mucks something up. Please right click and save this text file: adblock_analyticsjs_tracking_avinash.txt
If you want to see a working example of this, just do View Source in your browser and check out my implementation of the above code. You'll notice my UA id as well as the fact that I've set the dimensionIndex as 1 (which will also be true for you if you are not using Custom Dimensions yet).
So, what's the code above doing? For security reasons, JavaScript code is not allowed to know what extensions are running on a user's browser. This means we can't be 100% sure if the user has an ad blocker installed, but we can make a pretty good guess. The way this code works is it creates an HTML element with the class name "AdSense" and temporarily adds it to the page. If the user has an ad blocker installed, the element will be invisible, so if that's true after the code inspects the element, then we can be reasonably sure the user has some sort of ad blocker installed.
If you're using GTM and the Universal Analytics tag, you can configure the tag to set the custom dimension via a user-defined custom JavaScript variable. The following function can be passed as that JavaScript and it will share whether ad block is enabled in the browser…
adblock gtm tracking avinash
Please right click and save this text file for your use: adblock_gtm_tracking_avinash.txt
Honestly, that is all you need to do when it comes to things that touch your site.
Let now go and configure the Google Analytics front-end.
3. Setting Google Analytics front end elements (custom dimensions, segments)
Reporting for the ad blocking behavior of your users won't automatically show up in Google Analytics. We'll have to do two things to get set up.
Setup the custom dimension.
You need to have Admin privileges to do this step (if you don't have it, beg someone for it! :)).
Click on the Admin link in the top navigation.
On the resulting page, in the middle pane, called PROPERTY, you'll see a link called Custom Definitions (weirdly marked with a Dd), click on it.
Then, click on Custom Dimensions.
Then, the beautiful red button called + New Custom Dimension.
Here's the configuration…
ads blocked custom dimension
Hit Save, and you are done with this part.
ads blocked custom dimension final
Now you also know where the ZZ value of 1 in {dimensionIndex: ZZ} came from. Above.
Setup an advanced segment.
Go to any report in Google Analytics. On top of the main graph, you'll see a button called + Add Segment, click on it.
Now, click on the red button named + New Segment.
On the left-side of the create segment window, you'll see a list of choices, under Advanced click on Conditions.
In the box named Filter, in all likelihood the first button you'll see will read Ad Content, click on it.
You'll see a search box, type in Ads (of whatever you named your custom dimension above) and you'll see a Custom Dimension called Ads Blocked. Click. If your boss prohibits you from searching, you can also scroll to the Custom Dimensions category and choose from there.
The next choice you'll make is to change Contains to Exactly Matches, and finally in the box just type in 1. And, here's the end result…
ads blocked advanced segment
With this quick step… you are ready to rock and roll with data.
Before we go further, want to guess how many users of this blog, a self-described tech-savvy audience, use ad blockers?
Do I hear 80%?
Do I hear a 70%?
The answer will surprise you, it surprised me!
4. Five Reports and KPIs that deliver critical insights from ad blocking behavior
One caveat… This blog does not have any advertising on it. My books and my startup have links in the right nav, but most people won't think of them as pimpy ads as they are both mine and the books are inspired by the content from this blog. Hence, when I analyze the data below I might not find the type of insights between folks who use ad blocker and people who don't use ad blockers because on this site…. there is no advertising.
I'm going to teach you what types of reports and things to look for once you implement the above code. You are going to find fantastic insights from this analysis (like I do when I do this on sites that have lots of ads). But, you might not necessarily see them in the pictures I'm going to show you below – the pictures are just to teach you.
The very first simplest thing you'll do is figure out:
Q1. How many Users are blocking ads?
You can go to the first report you see when you log into Google and choose your Ads Blocked advanced segment (from above), and you'll be in business.
I LOVE custom reports [Five Smart Downloadable Custom Reports ]. I used one of my simpler acquisition custom report, and after I apply the segment, this is what it looks like…
google analytics ad block reporting overview
Roughly 14% is the answer.
I have to admit I was pretty darn shocked. Most of my experience suggested that the minimum would be 50%, and perhaps even as high as 75% because of the attributes of the audience that reads this blog.
So much for experience!
This the the fun part about data. It beats experience / opinion / hot air / gut feelings etc.
Go get your own data. Don't wait for a newspaper, guru, pontificator-in-chief give you a "best practice."
Also above, you can see bounce rates (I expect that it will be much more different on your site, remember I have no ads here so it would not really dirve big differences). And, you can see the all important metric of Conversion Rate.
Q2. What is the difference in content consumption between people who block ads and those that don't?
Simple. Go to the Behavior folder, click on Overview, and bada bing, bada boom…
ads blocked content consumption
There seems to be slight difference between the time that people stay on the site if they use ad blockers. On your site, if you have loads of ads, I suspect you'll see a much larger difference.
Also look at the contrasts between Pageviews and Unique Pageviews.
Q3. Given the difference in privacy concerns across countries, is the ads blocking rate materially different across the world?
Go to Audience, Geo, Location…. In the bread crumbs on top of the table in this report, I choose Continent (simply to show you the whole world in a small table in the space I have available here)…
google analytics ads blocked location
As you might have expected, Europe is the highest (but not by all that much). This was really fascinating for me because regardless of if I have ads on my site or note, this data is unaffected by the behavior things I was concerned about above. I would have expected Europe or Germany to have way, way higher than ad blocking then I saw in my blog's data.
Q4. Money! Do I have higher Per Session Goal Value from people who block ads?
Here's the theory behind this question: If the users are blocking ads they are having a better experience. And, if they are having a better experience, then it is more likely they deliver more goal value per session.
I created a quick and simple custom report for this (standard Google Analytics reports are so cluttered!).
Here's the main graph that allows me to reflect on long term trends…
ads blocked acquisition overview
For me at least, I would call it a wash.
Your mileage might wary because you'll actually have ads.
I consider this metric, Per Session Goal Value, to be critical for publishers and hence likely the best one you can use to measure the various implications on you from people's use of ad blockers.
Next, you'll look at the scorecard in the table, it gives you three simple metrics that will give context to PSGV…
ads blocked acquisition scorecard
And, finally of course you'll look to see if our KPI, PSGV, is influenced by the traffic source…
ads blocked acquisition detail
You can see the obvious differences above, it will give you a peek into the heads of the people coming to your site and it will also help you optimize your ad targeting and ad content strategies for Paid Media and even your Earned Media.
Q5. Do people who use ad blocking technologies end up being more loyal customers?
This is a very intriguing question to ask if you are a publisher. Does the recency and frequency change for people who use ad blockers?
Again, that is based on the hypothesis that if you are using ad blockers then supposedly you are having the best experience on the site, it should make your recency and frequency have a different (better!) profile.
I end up using this data to figure out, if the difference is material, to figure out how to consider monetizing these folks ("$5 for an ad-free experience, and you support us and keep us alive!").
There are other reports you can look at as well, but the collection of KPIs and reports above help you get pointed in the right direction.
And, that's a wrap!
As always, it is your turn now.
Do you track ad blocking behavior on your website today? If you use a different coding strategy, would you care to share it with us? How many people use ad blockers website, and what type of site is it? Do you see material differences in how people with ad blockers behave (bounce rates, depth of visit, per session goal value etc.) when compared to people who don't use ad blockers? Loaded question, do you block ads in your default browser?
Please share your strategies, successes, failures, lessons and advice via comments below.