The Full Guide to Unmasking Ad Blocker Traffic in Google Analytics

The Full Guide to Unmasking Ad Blocker Traffic in Google Analytics

So let’s start by addressing what may seem like an obvious question:

Why do I need to know who uses ad blockers on my website?

Ad Blocker software doesn’t care about your terms and conditions, or how hard you work to create your content. In the process of blocking your ads, it messes up your Google Analytics tracking – and it leaves you guessing.

  • Are my ads not loading properly?
  • Are my ads underperforming?
  • How many of my visitors never actually see them?
  • Who’s blocking my ads?

what percentage of your traffic is blocking your ads

Just to make things clear, we’ll say it again, we’re not going to tell you how to do anything against Google’s or any other network’s terms and conditions.. In fact, we’re just going to utilize a smart code strategy. It’s one that gives us a way to detect when ad blockers are being used. Let’s ask Mr. Doyle why that’s important:

“It is a capital mistake to theorize before one has data”
– Arthur Conan Doyle

Here’s the tl;dr of how to use Google Analytics to segment ad blocker data. The full step-by-step guide can be found below:

  1. Copy – paste the JavaScript snippet from below.
  2. Create Google Analytics Segment “Ads blocked.”
  3. Configure the new segment to capture the event data from the JS snippet.
  4. Repeat for “Ads not blocked.”
  5. Extra credit: Create custom dimensions for added flexibility.

Uncloaking the ad blocker data

Ad Blockers are definitely not as invisible as they might like to think. Of course, that’s not really their primary goal anyway. We’ll tell you, step by step, how to copy-paste a little piece of JavaScript code to better understand your ad blocking traffic.

We’re going to give you detailed configuration instructions. We’ll also explain how to to understand your new Google Analytics data. So what’s the end result?

  • You’ll know what percentage of your visitors are using ad blockers
  • You’ll be able to determine the impact it has on your Ad revenue

It’s kind of a big deal. Ad blocking cost the ad industry an estimated $22 billion during 2015. Usage grew by 41% worldwide in the last year. Gulp.

Here are the stats. Let’s figure out the extent of the issue for you.

First things first – your prerequisites

To use this strategy, your site must have both Google Analytics and Google AdSense installed.

We use these as the key elements of the detection hack, which by the way is by courtesy of the great contributors at Webmaster World. They detect when AdSense isn’t running as expected, which indicates that an ad blocker is in place. So that means ads from any network are most likely getting blocked too. All of your ads are gone… just like that.

FYI – For the purposes of our strategy, we’re ignoring users who are disabling Javascript entirely. This is a very small segment of your traffic. And they are very hard to track. They are likely highly techie/experienced users who are willing to accept a degraded presentation across the entire web.

Breaking down the ad blocker detection code

memebetter.com-20151203221554

If you’re expecting to get overwhelmed by a complex code setup, we have a great surprise for you.

The code we are using is actually only 11 short lines – but really smart ones. Now we’ll post the code for you, and then give you a quick overview of what it actually does once added to your pages.

The Code snippet

<script>

if(typeof adsbygoogle !== “undefined”) {

window.addEventListener(‘load’, function() {

  if(typeof ga !== “undefined”) {

    if(typeof adsbygoogle.loaded === “undefined”) {

      ga(‘send’, ‘event’, ‘AdSense’, ‘Ads blocked’, { “nonInteraction”: 1 });

    } else {

      ga(‘send’, ‘event’, ‘AdSense’, ‘Ads not blocked’, { “nonInteraction”: 1 });

    }

  }

}, false);

}

</script>

If you want to track only “Ads blocked” events, you can use this modified version:

<script>

if(typeof adsbygoogle !== “undefined”) {

window.addEventListener(‘load’, function() {

  if(typeof adsbygoogle.loaded === “undefined” && typeof ga !== “undefined”) {

    ga(‘send’, ‘event’, ‘AdSense’, ‘Ads blocked’, { “nonInteraction”: 1 });

  }

}, false);

}

</script>

We’ll let you know why some high traffic sites might prefer to do this later, when we talk about “collection limits”.

How to install the ad blocker tracking code

If you’ve installed snippets of code on your site before, you’re good to go. If not, we really recommend you add a tag management system like Google Tag Manager. Otherwise, please contact your friendly neighborhood web developer for a quick code update.

Paste the code snippet just before the ending </body> tag of your site template. It needs to show up on every page. That’s all you need for the code installation part.

Note: For this hack to work, your Google Analytics has to be Universal Analytics or the version containing “analytics.js.”

What does the JavaScript code do?

This isn’t a coding tutorial, so we won’t bore you to death with any more technical complexity than needed. It’s just a bit of really smart Javascript. Here is what is happening step by step:

  1. Wait for the page to load, and then check to see if Google Analytics successfully loaded.
  2. If GA loaded Javascript, then it is working, so check to see if your Google AdSense loaded too.
  3. Send some data to your Google Analytics account to indicate whether the ad was blocked or not.

If your pages load up and your Google Analytics is doing what it’s supposed to do, you check your AdSense.

And if AdSense doesn’t load? Then we can reasonably infer that it was prevented from loading by an ad blocker. Busted!

That’s it. Some slick code using some smart logic to segment the users that are ad blocking and those who are not. Then it sends this information into Google Analytics for your to review.

A single line of code tells Google Analytics to store an event for us. That event tells us whether we detected the ad blocked or not. That’s it.

A quick note on collection limits

As the team over at Webmaster World pointed out, sending your custom events to Google Analytics is subject to collection limits.

In short, if you have traffic that exceeds 10 million hits per site in a month, you’ll end up speaking with a Google rep. They’ll discuss upgrading you to a premium account with higher limits with you. By the way, you can also become a premium Google AdSense publisher with less than astronomical traffic. Here’s how.

What can you do with this data?

Now that our nifty piece of code is generating data, we need to visualize the data through Google Analytics. You can use another analytical platform if you prefer but this tutorial is GA focused.

Display your ad blocker stats in Google Analytics – Custom Segments

Google Analytics custom segments lets us group our data in new ways. In our case, it will be straightforward, based on two new data segments:

  • Traffic with ads blocked
  • Traffic without ads blocked

That lets us compare all the performance and behavior data for both segments –  the ad blockers versus those seeing your ads.

Step 1 – Go to “Audience Overview” and Add a Segment

add a segment on google analytics

Step 2 – Create a new segment for “Ads blocked”

Create a New Segment for “Ads blocked”

Step 3 – Configure new segment

Configure New Google AnalyticsSegment

  • Enter “Ads blocked” for the segment name
  • Select “Conditions” under “Advanced” (left column)
  • From the dropdown, select “Event Action” from the “Behavior” group
  • In the input field for the event action, enter “Ads blocked” again.
  • Click “Save” to create your new segment

Our new segment is going to be based on the events we created with our code snippet. Every time it detects that an ad is blocked, it saves it to Google Analytics. We’re now using those events to create a new segment.

Step 4 – Repeat for “Ads not blocked”

Now we want to repeat steps 1 through 3. This time we’ll create a new segment in the same way for “Ads not blocked”.

When we’re finished, these segments give us great insights into the difference between our ad blocking users and regulars users.

Repeat for “Ads Not Blocked”

Once you have this setup for both Ads blocked and Ads not blocked events, you can compare them against other data types. In the image above, we’ll looking at both ad blocked and non-ad blocked events, compared with all user sessions.

But that is just one method: segmenting by detecting events. We can also enhance our analytics by adding custom dimensions.

Note: “Ads blocked” and “Ads not blocked” are case sensitive so make sure to define them as shown here.

Extra credit: Why use a Custom Dimension?

Using a custom dimension is our second strategy for adding ad blocker status into our Google Analytics data.

A dimension is simply an attribute of a web visitor. A simple example would be demographic data like what city they are located in. Every session will be attributed a custom dimension. 

Just like the type of web browser they are using is a dimension, whether they are running an ad blocker or not also makes a great custom dimension.

So we’ll show you how to create this new custom dimension and add it to your GA tracking code.

Creating your new ad blocking Custom Dimension

So our goal now is to setup “Ad Blocker Status” as a custom dimension. We do this from our main Google Analytics admin page.

Step 1 – Click on the “Admin” tab at the top of the page

If you have multiple sites, make sure you click on “All Website Data”

Click on the “Admin” Tab at the Top of the Page

Step 2 – From the settings, choose “Custom Definitions”

Step 2 - From the Settings, Choose “Custom Definitions”

 

Step 3 – Choose “New Custom Dimension”

Step 3 - Choose “New Custom Dimension”

Step 4 – Give the dimension the name “Ad Blocker Status” and select “Session” for Scope

Click the “Create” button to proceed to the final step.

ga-new

Step 5 – Review the examples and click “Done”

Well, you can take a look at the code. However, the most important step is for you to click “Done”. We are going to provide you with the modified Google Analytics tracking code in the next step.

modified Google Analytics tracking code

Step 6 – Now we’ll replace the previous code snippet on your site

In the previous code snippet we provided you, we were setting a custom event only. Now we are working on adding dimension data.

Here is the modified snippet you can use to replace the previous version in your site template. Again, if you are not comfortable editing code within your web template, then you will need to get your web developer to assist you.

The new snippet for adding dimension tracking

The new code that we added is highlighted in blue so that you can see the change.

if (typeof adsbygoogle !== “undefined”) {

   window.addEventListener(‘load’, function () {

       if (typeof ga !== “undefined”) {

           if (typeof adsbygoogle.loaded === “undefined”) {

               ga(‘set’, ‘dimension1’, ‘Ads Blocked’);

               ga(‘send’, ‘event’, ‘AdSense’, ‘Ads blocked’, {“nonInteraction”: 1});

           } else {

               ga(‘set’, ‘dimension1’, ‘Ads Displaying’);

               ga(‘send’, ‘event’, ‘AdSense’, ‘Ads not blocked’, {“nonInteraction”: 1});

           }

       }

   }, false);

}

This snippet not only sends the ad blocker event data, it also adds our new dimension.

Looking at Ad Blocker Status as a secondary dimension

When we create new custom dimensions, they become accessible in our Google Analytics reports as a secondary dimension.

Looking at Ad Blocker Status As a Secondary Dimension

You can select “Ad Blocker Status” from the “Secondary Dimension” dropdown menu. It’s in the “Custom Dimensions” section.

Then you can view your analytic data with the ad blocker status included in the report. C’est tout!

So what percentage of your visitors are blocking your ads?

We’ve given you two different ways to detect and track your users who are ad blocking. It’s important for you to be aware of how much of your traffic never gets to see any ads.

You can also examine the data to see how not having ads changes the user experience. For instance, do users that see the site without ads stay on your site longer before bouncing?

Then you can get creative. If a large percentage of your users are using ad blockers, that’s a lot of revenue you may be losing. By any chance, is there another way to monetize your traffic?

These are the kinds of decisions we get to start thinking about once we get our hands on the data. But we can’t do it flying blind. We absolutely need to know how many of our users are being mischievous with their ad blockers.

Share with us: If you configure Google Analytics to discover how many of your users are ad blocking, please post a comment here so that we can compare. If it’s unusually high or low, we may be able to pinpoint a critical factor influencing it. That’s the power of data!

I’m Head of Marketing Operations at AdNgin. Before coming to AdNgin, I was a marketing professional focused on SAAS business models. When I’m not working, which is rare, I sail and hang out with my son, Jonathan, and wife, Meital.
Start optimizing Page Views
  • Frank

    This is really helpful, I didn’t know this idea, thank you so much. Bookmarked.

  • joy

    What great tips! Plus the post is very entertaining. Thanks for sharing

  • Micheal Scott

    Lots of great info here for ad-sense users! Great article.

  • jonathan

    I am just finally making some money on one of my sites with AdSense. Keep on your good work!

  • d boy

    Keep on your good work! Thanks

  • jmagnone

    Very helpful. Thanks.
    In one of my sites, I am using BlockAdBlock JS Script to have more flexibility dealing with ad blockers.
    I just combined your approach with this script in order to track users with ad blockers.

    • Thanks for your comment. You’re actually the second person today who told me that they’ve implemented this script to run alongside another successfully. By the way, if you’re interested in fighting ad blockers the clean way you should also check out this post: adngin.com/blog/adsense-tips/how-to-fight-ad-blockers-successfully-using-7-psychological-phenomenons/

  • Pingback: 8 Mind Blowing Hacks to Leverage for Your CPC Ad Earnings | AdNgin()

  • Pingback: 10 Tips to Increase Your Stuck AdSense Revenues | AdNgin()