If you’ve read any of my older posts you probably know that I’ve been involved in internet advertising, in some form, for a long time now. Lately I’ve been seeing more and more posts about how ad blocking is growing at a tremendous rate. I still have some sites that make money from display advertising so I was curious just how many of my users are actually using ad blocking tools. I decided to see if there was a way I could track the users who do use tools like AdBlock vs the users who do not.
I noticed that the script allows custom code to be executed when adblock is detected or not detected. Then I remembered that Google Analytics allows you to set custom variables. Combining these two functions we should be able to track which users are using ad blockers in Google Analytics.
First you want to download blockadblock.js. Rename it to something else, I called mine GA.js and include it in your site’s header.
After this runs for awhile it will start collection custom variable data. You can check the data in the Google Analytics dashboard by going to Your Site -> Audience -> Custom -> Custom Variables. You will see one that says “adblock”. If you click the link it will then take you to a report that shows if a user has adblock enabled or disabled. Yes means adblock was detected: