Ad Block Tracking With Google Analytics: Code, Metrics, Reports

PartialYou don't use an ad blocker, right? Of course not! You would never want to take away the opportunity a content creator has online to monetize their work via ads.

I know that at least some of you think I'm being sarcastic. I am not, and this post is all about getting the data to show you that I am indeed not being sarcastic.

I am insanely excited that we can track ad blocking behavior in Google Analytics, so easily. This post covers these key elements:

Here's how this post unfolds…

While you could call on your favorite IT BFF to do this for you, let me encourage you by saying that if I can do this all by myself…. You can do it too! Honestly, it is that easy.

Excited? Let's go!

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.

Here's a tweet by my wonderful friend Mitch Joel.

mitch joel adblocking tweet

Can you blame him for wanting to install an ad blocker?

And, now, whose fault is it? Both the non-intelligent advertiser and the non-intelligent publisher. Neither wants to grow up and consider using the data available for Mitch to be smarter about advertising. Both simply want cheap let me not work all that hard for it money.

Take thi second example from Forbes magazine on mobile… They are absolutely well within their rights to create a firewall around their site for people who use ad blockers…

Forbes Ad-Light

But think about their text in green for a moment.

On a mobile platform should Forbes not have pity on its users and load the unwanted ads as fast as it can? On a mobile device, which we use more often in deeply private (beds) and openly public (subway) situations should they not auto-play videos?

They should. They can block their site, they can ask everyone to pay for content, they can ask people to pay for no-ads. It is their right. But, the above is close to a ransom note from a corporation to exhibit basic human decency.

In all the discussions for inherent awfulness of users of ad blocking solutions, this perspective never gets as much play. After all the people with the ink are the ones with the non-intelligent cheap money seeking existences.

I hope in the discussion of ad blocking, this gets some play. Relevance in advertising is possible, it is even exciting. Consider the See-Think-Do-Care business framework, discern the intent of your audience and ensure that you ad content, ad targeting and ad landing page are aligned with your audience's intent. You will be rich. They will be happier.

Speaking for me. I simply pay to get rid of advertising wherever I find it is awful (including at my employer, or powered by my employer's platforms). I love YouTube Red (and get Google Play Music for free!!). I'm happy to pay for Google Contributor. I'm curious to see the evolution of Optimal, a startup working on a similar solution. I actively control my Google Ads (sadly other platforms are not this kind), I spend a lot of time on The New York Times and The New Yorker, pay for both. And, of course I would not be as smart about digital marketing as I am without paying for Baekdal Plus.

You see different models people use to make money there. You can make money with content. You just need to create something incredible of value and want to make intelligent money.

Conversely if your strategy is to not change, not think about the value exchange carefully enough, not innovate, then blocking off access to content of an entire country will still fail. I give you Sweden.

Let me get off my high horse, and let's get some tracking going!

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.

Nice report right? Acquisition, behavior, outcomes!

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.

Thank you.

PS: If you have not signed up for my pithy and insightful newsletter, I would love to have you as a subscriber. Sign up here: The Marketing-Analytics Intersect.


  1. 1
    Michelle Olsan says

    A perfectly illustrated article!

    I have read a couple other articles to accomplish this goal but they tend to be too geeky and skip over detail that novices like me need.

    Now finally you have made it easy for me to track ad blocking with google analytics.

    Thank you for a solution that all of us non-geeks can use right away.

  2. 2

    "You can make money with content. You just need to create something incredible of value and want to make intelligent money."

    (hope it shows the gif)

  3. 4

    Hi Avinash,

    Thanks for the GTM script, just installed it on my blog as well.

    To your question about whether the ad blockers segment is more valuable to a publisher site, this could go back to the goals setup on the site. A few questions that came to my mind were around whether this segment is more likely to:

    – create an account?
    – comment on content?
    – share content, thereby bringing new visitors?
    – Read through the complete article? This could be known via scroll tracking and can help in selling native advertising on publisher websites.

    (Useful scroll tracking script by Lunametrics:

  4. 5

    Hi Avinash,

    Great article, as always. I'll definitely look to get this implemented.

    One question I have – can you combine this Ads Blocked custom dimension with page load speed data in Google Analytics, in order to understand how much faster page load is for sessions with adblocker compared to sessions without? Would be very interested to try and quantify what this difference is.

    Thanks in advance,


    • 6

      Neil: I do not believe that you can at the moment.

      The reason is that I'm able to slice and dice the data, as you see in the reports shown in this post, because they are all from the same dataset with connected primary keys.

      The data for page load etc., comes into GA from a different data source and hence is an independent pool in GA. Think of it like the Google Webmaster Tools data in GA, there for your convenience.


  5. 7
    Oscar Ochoa says

    Nice Post Avinash Thank you, we've been tracking ad blocks via events:

    When the ad is not loaded a new non interactive event is fired up:

    $('#homeData').collapseMenu({ linkSelector: 'div > a.toggle' });
    if( window.canRunAds === undefined ){
    // adblocker detected

  6. 8

    Hi Avinash,

    I tried to install the GTM script in my website (, but when I try to execute it, it returns an error:

    "Uncaught DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.(…)"

    Analysing the code, I found that the GTM script version adds a child to the head and try to remove from the body. When I corrected it, changed the head.append to body.append, it started working and returning the right return.

    • 9

      Ramiro: So very kind of you to catch this!

      I have fixed both the image and the raw code in the text file. We should be good to go now.


      PS: A good lesson for me, blogging at two o'clock in the night is an activity that comes with it's own dangers. :)

  7. 10

    Silly question: aren't ad blockers also blocking Google Analytics itself?

    • 11

      Michael: OMG, yes. Some of them do, there does not seem to be a universality about it.

      The cool thing is that it is also easy to find that data. I won't link to those solutions, surely you know how to get to Bing or Google. :) But, having used those solutions to track how many ad blockers are blocking Adobe/Omniture, Google Analytics and other solutions, I was, as above, surprised to see the results (they were small in my sample of tracking across 70 or so sites of different types). The cool things is, you can do the same to get data.

      One small thing… The code above is not tracking if you use adblock or not. It is measuring if ad blocking behavior is occurring. The latter could happen for many reasons (including ad block type extensions).



      • 12
        Jason Packer says

        Hi Avinash,
        Are you saying there are well-known solutions to see how many users are blocking Google Analytics? I've done some research on how to count how many users are blocking Google Analytics here:, but I wasn't aware that there was much out there on the subject otherwise?

        Certainly a lot of users that block ads also block analytics trackers & thus become invisible to being counted at all this way, but since there's nothing on the page that can easily be tested for visibility like an ad unit not being displayed it gets a lot more convoluted to try and count those users as well.

        • 13

          Jason: I"m not sure how well known the efforts are, but it should not surprise you that with so many people involved in analytics and advertising that there are lots of them who spend time trying to get data to better understand how web users behave. :)

          Two contextual bits though. As I mentioned to Tony in my reply, my interest here is not to track those who have tracking blocked – see more there. And, we get so much data already from our website visitors, being able to capture this extra element, from those that are allowing tracking, still allows us to make smarter decisions about content, business strategies and user experience.

          Thank you for sharing your post, it is a great read!


      • 14


        Indeed, GA itself (and even GTM!) are blocked in some instances. For example, the EasyPrivacy list (enabled in e.g. AdBlock Plus) blocks HTTP requests to the GA and GTM endpoints. Firefox's new private browsing mode blocks GA (this is huge!) but not GTM.

        One way to count the number of blockers is to parse web server logs. It's not too robust, as you'll need to filter out bot and crawler traffic first, and the concept of a "session" isn't available in server logs.

        Another way to track the rate of AdBlocking is to use a proxy. Firat, host analytics.js locally, then use sendHitTask to copy the payload to GA, and send it to your web server. Then, in the server, tunnel the request to GA using Measurement Protocol. I don't want to specify further steps, as I actually want to respect those who block GA by not tracking them at all, but you should get a general idea of how to do it from the description above.

        Great post as usual, Avinash. Great to see more technical stuff from you every now and then :)

        Best regards,

        Simo Ahava

    • 15

      That is absolutely correct–some do! The tool that I use, Ghostery, does block GA. Ghostery is such a powerful tool for people in the business of tagging and tracking, that I wouldn't be surprised if a large portion of this audience uses "the purple box."

      I've also found Ghostery particularly elusive to detect. The only artifact in the DOM is an element with a randomized id. That element does have a title attribute with a string value I've been using, but they could change it at any time, and invalidate my method. (title="Click to dismiss alert bubble")

      • 16

        Tony: You are right about Ghostery.

        I do want to share that the code I've shared in this post is not trying to unhide or undercut or beat the wishes of users who don't want a web analytics tool to track them. If they don't want tracking, nothing happens.

        What is recommended in this post simply checks if people whose behavior is being captured by analytics tools anyway are also blocking ads.


  8. 17

    The reason a 'low' number of visitors to your site use adblock is they work in SEO / PPC and 'need' to see ads!

    • 18

      C Byrne: Hmm… a very good point. I'm confident that is a contributing factor.

      The readers of this blog though represent a very wide variety when it comes to types, due to the diversity of topics and overlap between marketing and analytics. Hence the surprise.

      But, data is data, better than opinion! :)


  9. 19
    Jennifer says


    Great post, thanks for the perspective. I hate the Forbes thing you bring up. I have white listed them, turned off my ad blocker for their site, cleared my cookies and brushed my teeth and I still can't get past their ransom. I pretty much ignore articles now that I see on LinkedIn that go to Forbes which is a shame, they are probably really good!

    Is there a typo in the article? It feels like it is missing a NOT, but maybe you are saying that your books and startup are ads so this blog does have advertising on it in which case you would remove the ANY.

    One caveat… This blog does 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.


  10. 21
    T. Alexander Yano says

    Quick Question: When you add the Custom Dimension to the Universal Analytics tracking tag in Google Tag Manger as "{{AdBlockEnabled}}"….what is the Dimension Value to add? I added "1"…is that correct?

    Thanks in advance!

    • 22

      It is whatever Custom Dimension Index you want to use.

      Go to your Admin section -> Custom Definitions -> Custom Dimensions and look which indexes are already taken and create your Ad Blocker Custom Dim there.

      So in the free GA, it should be an index between 1 and 20.

  11. 23

    Hey Avinash,

    I've followed your steps above and added the tracking code/custom dimension/segment.

    However it's not showing any ad block users, can I assume this is because this new segment won't work with historical data?



    • 24

      It won't work with historical data.

      Any data you collect (the information whether ad blockers are detected is also "data") is available only from the day you collect it.

  12. 25

    This is a nice method, but I would only take the Ad Blocking percentages as a raw/broad tendency and not take the 15% for the real number (which is probably higher). It has already been mentioned that GTM and GA are themselves often the victims of Ad Blockers, overly ambitious Anti-Virus programs, Incognito and enhanced privacy modes in some browsers etc.

    So the only way to really test for Ad Blockers is to run your script (plus one that checks whether your GA/GTM/Adobe Analytics code was executed at all) in the page's HTML code itself (not through an injection via a Tag Management System because that itself might get blocked). Then, instead of sending the result through the browser to your Web Analytics system (that request will likely be blocked as well), you need to send it via a server-side script to Adobe, Google or whatever inhouse Analytics/Data Lake solution you are using. I know, quite tedious, and then you still have to clean out all the bot traffic to differentiate humans that are blocking ads from bots that are blocking ads. The "Exclude Bots and Spiders" checkbox does not really help much in preventing Bot Traffic to pollute your Google Analytics data, we have new cases of unidentified robots every week distorting the data a lot.

    Still, the solution in this post is better than nothing, so if you don't have access to bigger IT resources, then at least implement this.

  13. 26

    Hey avinash..

    This is a very helpful solution to a complex challenge. I've implemented it on my site. I am excited to see what the results will be. I really want to know how ad block is affecting my earnings.


  14. 27

    Thanks Avinash for gripping article as usual…

    Its quite fascinating how the article and comments show desperation on part of publishers as well as users. with Forbes holding content for ransom and users ready to brush their teeth :D to consume content.

    Hope I dont have to to shave my beard some day to access this blog :)

  15. 28

    Hi Avinash,

    Great article, thanks for your precious time!

    I've question in the scope of the custom dimension, should we put session opposite of hit , otherwise will count in every single hit?

    Guys don´t miss the #TMAI this great email digest in

    Thanks again

    • 29

      Jorge: Very good question.

      Session is probably fine, but in theory a user could turn off adblock mid-session, and then you'd lose that granularity if you were to have a report like pageviews by "ads blocked." That's a small detail, trying to solve for even more precision by using Hit.

      PS: You are so kind to recommend TMAI, gracias!

  16. 30
    Robin Harper says

    We added the code on Friday and it successfully tracked users with Ad Blockers, however it had a side effect in that none of our ecommerce sales were recorded for those 2 1/2 days, so we had to revert back to our old code today.

    Do you know why that would happen and how to fix? Thank you!!

    • 31

      Robin: This should not happen, there is nothing in the code that would cause the issue you mention. I say that both because of what the code is doing and having tested it on all types of site.

      It is hard to figure out what might be happening on your site without having access to it and the code. But, my peer Philip suggest two simple things:

      – You might have deleted your ecommerce code when adding the adblocking code (happens more than you might imagine)
      – You used a custom dimension that was already being used for something else in the ecommerce setup (might be less possible, but worth checking)

      If you need more help, you can ping a GACP, here's a list:


  17. 32
    Will Chou says


    This is really cool. Thanks so much for writing this.

    Will Chou

  18. 33
    Karolis says

    I do respect content and website creators and therefore do not use AdBlock, because I want to give them traffic.

    Great post once again! I can go and action it on my website with your easy to follow detailed directions.

  19. 34
    Corey Zeimen says

    14% is a lot.

    A secondary call to action on your site to opt into a newsletter can go a long way to optimize for loss from ad revenue if you heavily rely on ad revenue.

  20. 35
    Dennis says

    Tanks for the code!!

  21. 36

    Thanks for a hugely detailed post. The key take way though is that there should be no need for ad blockers if advertisers actually thought about what they were doing in the first place.

    And with regards to "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" then please do! Far too many of them are guilty of putting short term profit over long term UX.


  22. 37

    Thank you for sharing the post :)

  23. 38

    I'm going to try this.

    It will really come in handy to see how many people are blocking ads.

  24. 39
    Salomon Dayan says

    We've implemented in one of our landing pages and we see less than 1%. That is actually catching my attention as a recent emarketer report accounts for 26%

  25. 40
    Josh Paiva says

    I just found your blog and can't believe I haven't read any of your content before today.

    I just pulled at least 4 or 5 golden nuggets out of this one post.

  26. 41

    Thank you for the detailed post. It is extremely valuable.

  27. 42
    Siddhant Sharma says


    I am new in analytics, so eager to learn that what all can be tracked and what are the benefits of each tracking strategy.

    I'm off to implement ad-block tracking using your instructions, and look forward for more blog posts of similar type in the future.

    Honestly thank you for this information!!

  28. 43

    Hey kaushik
    Thanks for sharing this useful information.Thanks for clearing my doubt's about analytics.
    Keep Rocking

  29. 44

    Great post Avinash, thank you

    I am new in this analytics world…, so forgive me the question: should not we be comparing the segment Ad Blocks against its opposite (ie, non-Ad Blocks) as supposed to the total user population? Could not we see a more revealing / insightful difference in behaviour and sales / value performance this way?


  30. 46
    p byrne says

    Article misses point.

    We don't want to live in a world inundated with ads everywhere we go.

  31. 47

    Thanks for the post! The solution seems pretty clean to me.

    I'm wondering though, if there is a way to implement this solely using the Tag Manager?

    Googles documentation states that analytics.js plugins can not be used with the Tag Manager (yet). I imagine using a custom html tag would work, but using the predefined Google Analytics Tag is definitely preferable.

  32. 48

    Hi Avinash,

    Do you work with Piwik at all?

    I tried to modify your technique here for it, but I can't find a way to do this correctly. Any clues?

    • 49

      Richard: I have used Piwik and think well of it.

      I am afraid it works fundamentally differently and hence you'll have to work with the team to identify what might be the most relevant strategy.


  33. 50
    Kalyan Banga says

    Hi Avinash,

    Very well written, liked your post as always!

    Since i am data driven guy (Founder of, thought of checking if you have drilled down statistics on break-up of ad-blocks by gender, age, country, device used for browsing, OS etc.

    Though these are much granular details and I am not expecting to get all details over a blog, still if you have something to share it would be great.

    Thank you!

    • 51

      Kalyan: I'm afraid I don't have any access to that data, but I do know that various entities research ad-blocking behavior and perhaps they might be of value. A Google search might be enough.

      In context of your site, you should be able to apply the Ad-Block segment created in this post to your Devices report, your Geo report, your OS report and all other reports you have in GA. That will give you detailed data about your own users.


  34. 52

    Interesting article, plenty of good info.

    A little more perspective, ad delivery by "Certified advertisers" is a point to make here is that with more than half of those advertisers holding certificates being unscrupulous and quite unreasonable with delivery options and handling.

    Ad Blocking has become a necessity for the purposes of privacy and security and yes if your smart the first thing you turn off is javascript.

    Just a thought.

  35. 53

    The ads need to roll back on how intrusive they're being and many people wouldn't mind so much. Many companies are restricting access to content if they're using an ad-blocker, but content providers need to re-evaluate if they're overdoing the ads to such an extent that blockers a necessity.

    There's an online publication in my area which loads more than a dozen ads on an average page – more than one of these immediately plays video footage. The background of the page also becomes an ad too – it's just such a huge amount of additional time and bandwidth, but they're adamant that the ads need to stay as they are.

  36. 54
    Rick Bell says


    Would appreciate if you could email me a further explanation to set up the function ADBlockEnabled used in GTM i.e. "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…"

    many thanks in advance

  37. 55

    I'm excited to try out this GTM pathway of tracking adblocking.

    We actually have tried this other method of ads.js mentioned above but it works in our legacy platform and not our next gen platform for some reason. NG is react though so that may have something to do with it.

    In any case, we use GTM and I do personally so I'm gonna try this out on my site as soon as I can and transfer that knowledge if it works! Thanks!

  38. 56

    I figured it out. I'm an analytics newbie as you can see though, now I have to try to figure out how to create these pretty reports you show off. All I want is percentage true and percentage false, it shouldn't be this hard Google !

  39. 57

    So if you have some time, or anyone can point out a post on how to properly set up GA and create reports to whether adblock is true or false, please point that out.

    I'm using the new GA tag (and I think it's set up right) but I only get reports of the event adblock. I can't get the charts of how many are true and how many are false over the last week or month.


  40. 58
    Pawel Mansfeld says

    I wish I'd discovered your article earlier.

    Thank you Avinash!


  1. […]
    In deze blog heb ik je 4 praktijkvoorbeelden met segmenten laten zien. Er zijn natuurlijk nog veel meer segmenten te bedenken om deze op de gebruikers-verkenner toe te passen. Onderstaand nog enkele suggesties/ideeën: Gebruikers met een AdBlocker > vooral interessant voor content/media sites.

  2. […]
    Ad Block Tracking with Google Analytics
    I am almost always up for an experiment and this is one I can’t wait to run. Avinash Kaushik who write’s Occam’s Razor and you’ll likely see here a bit as I read all of his posts shares some snippets of code to test if you’re visitors are using ad blockers.

  3. […]
    Here Avinash explains what’s an ad block and offers a tracking code change through Google Tag Manager or directly together with setting the custom dimensions and segments in Google Analytics. The last part shows 5 reports and KPIs that deliver critical insights from ad blocking behavior. If you’re concerned about your customers using ad blockers, this is the way to understand its impact.

  4. […]
    Con MovingUp – l’azienda con cui collaboro – seguiamo diversi editori che hanno inevitabilmente come modello di business anche quello della rivendita pubblicitaria dei propri spazi , quello che segue è il dato di uno dei nostri clienti più piccoli ma con un profilo molto generalista. Sono intervenuto su Google Analytics per creare una dimensione che mi mostrasse il numero degli utenti che utilizzano qualche AdBlock e il dato è decisamente interessante. (Volete sapere come implementare anche voi una Custom Dimension per rilevare i vostri visitatori che utilizzano AdBlock? Qui c’è l’ottima guida all’implementazione su Google Analytics di Avinash Kaushik).

  5. […]
    Si quieres medir cuanta gente bloquea los anuncios de tu web, Avinash nos cuenta cómo hacerlo.

  6. […]
    La otra opción es añadir unas lineas en nuestro código de seguimiento de Analytics. En un excelente publicación de Avinash Kaushik, nos indica los pasos a seguir para hacer unas modificaciones en Analytics para poder medir a los usuarios que usen bloqueadores. Ya advertimos que algunas ediciones de AdBlockers no son detectables de esta forma, pero puede servirnos para hacernos una idea.

  7. […]
    While searching the web, I manage to come across two approaches to determining if a user has an ad blocker installed. One here and another here. The first approach does not seem to work for uBlock Origin, as I was not getting the desired results. The second approach using a custom ads.js file, worked like a charm :)…

  8. […]
    W przypadku korzystania z innych strategii zliczających odsetek internautów blokujących reklamy, podziel się nią z nami w sekcji komentarzy. Pochwal się również swoimi danymi np. na temat tego, ile osób korzysta z AdBlocka. Czy widzisz różnice materialne oraz lojalnościowe? Jeżeli jesteś przeciw wtyczkom do blokowania reklam, to zapraszamy również do konstruktywnej debaty w komentarzach. Źródło informacji: Occam’s Razor by Avinash Kaushik.

  9. […]
    Ad Block Tracking With Google Analytics Code, Metrics, Reports Ad Block Tracking With Google Analytics: Code, Metrics, Reports

  10. […]
    Now I’m no Marketing professional, not yet anyway, nor am I an expert if the field. However in my on opinion I find what Kaushik has to say extremely interesting and extensively relevant to anyone in the world trying to connect and share their good content with others. As always ladies and Gentlemen. Stay Safe and please go check out Kaushiks blog is really good.

  11. […]
    Existen varios post que hablan sobre este tema, nosotros nos vamos a servir de la función que propone Avinash Kaushik en su post de Ad block Tracking, para lanzar esta información a Google Analytics.

  12. […]
    However in my on opinion I find what Kaushik has to say extremely interesting and extensively relevant to anyone in the world trying to connect and share their good content with others. As always ladies and Gentlemen. Stay Safe and please go check out Kaushiks blog is really good.

  13. […]
    Niet alle Ad Blockers blokkeren het inladen van het Google Analytics of Google Tag Manager script. In dit artikel wordt aangegeven 'Which Ad Blockers are blocking Google Analytics?' en ook Avinash Kaushik heeft hier een interessant artikel over geschreven: Ad Block Tracking With Google Analytics: Code, Metrics, Reports.

Add your Perspective