A Guide to Understanding Ad Blocked Traffic in Google Analytics

Dec 11
08:41

2015

Eyal Katz

Eyal Katz

  • Share this article on Facebook
  • Share this article on Twitter
  • Share this article on Linkedin

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.

mediaimage

Ad Blocker software doesn't care about your terms and conditions,A Guide to Understanding Ad Blocked Traffic in Google Analytics Articles 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?

     

 

Just to make things clear, we'll say it again, we're not going to tell you how to do anything illegal. 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

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 publishers an estimated $22 billion during 2015. Usage grew by 41% worldwide in the last year. Gulp.

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.

Here's the TL;DR

You need this JavaScript snippet:

//

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);

}

// ]]>

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

//

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);

}

// ]]>

Now that you've pasted the above, let's go over to Google Analytics and get down to business:


  1. Create a Custom Segment

     


  2. Create New Segment for "Ads blocked"

     


  3. Configure new segment to grab data for the event created in the above JavaScript.

     


  4. Repeat for "Ads not blocked"

     


  5. Extra credit: Create a custom dimension

     

 

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 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.

Make sure to read the full article with some extra features for advanced users.