How to Track AdBlock Users in WordPress with Google Analytics?

Track AdBlock Users in WordPress with Google Analytics

Track your AdBlock enabled users to better understand your earning growth and take useful business decisions.

Since the day AdBlocking service has been released,

It has become the nightmare of all content creators,

This is obvious as content creators spend hours researching things and building up great content.

But the problem is not all content creators are good,

Some of them have no aptitude for creating good content and just have a site to make money from it.

The most trusted ad publisher on the web i.e. Google Adsense doesn’t allow this kind of publishers on board with them.

And eventually, these content creators get frustrated and start using disgusting Ad services just to earn a few pence.

AdBlock was created to save users from those annoying ads that we all hate.

Last month I did an international survey where 82% of people said that they have no problem enabling AdSense ads,

They just have enabled AdBlock service to stay away from those annoying popup ads, malware ads, etc.

But even if someone loves your work,

It is very unlikely they are going to whitelist your site on AdBlock,

Even if you say that you use Google Adsense.

That’s because humans are lazy beings.

It’s not like that they don’t wanna whitelist your site,

It’s just they are too lazy to do it.

A few months back I wrote an article about how to show up affiliate ad banners smartly when some users have AdBlock enabled.

But after using that for months I find out a shocking thing about human psychology.

If someone has enabled adblocker on their browser that means they don’t wanna see any ads anyways.

By forcefully showing affiliate ads you are not just ruining the user experience of your site,

You are actually losing your trust in your user’s eyes.

So, I went back and forth with many testing to figure out what is the best way to track AdBlock enabled users’ behavior without ruing the user experience of my website a bit.

After testing so many things,

I find out that the best way to track Adblock enabled users is through Google Analytics.

As you can gather all the information about your users depending upon their AdBlock status and even generate a custom report to take a crucial business decision too.

Today I’m going to show you how you can track your Adblock enabled users in WordPress using the extraordinary analytical tool i.e. Google Analytics.

The things that we need to get started to track Adblock Users

Here are a few things that you must need to have before starting the process:

  • You just need to have a self-hosted WordPress site.
  • This script is only for AdSense users I do not support using any other ad publishers as they all are nothing but garbage. It just decreases user experience with annoying ads.
  • This script will only work if you are using the asynchronous version of the Google Adsense code. If you are not using that, then you should upgrade now as it highly reduces page load time.
  • You just need to have Google Analytics by Yoast Plugin for WordPress (the best Google Analytics for WordPress plugin) enabled and properly authenticated to your Google Analytics account.
  • After authenticating with your analytics account go to the Analytics -> Settings from your WordPress Dashboard and click on the Universal tab.
  • Under Universal tab, mark the checkbox that says “Enable Universal Tracking” and hit save.
  • The rest of the plugin settings is up to your need, but the default settings are more than fine for most of the sites.

Enabling Custom Event Tracking

This is the part where things get a little complicated.

But I will try my best to keep things as easy as possible,

So that everyone (be it a non-techy user or pro dev) all can understand how to achieve it.

For Non-Techy Users

If you are not so techy or maybe not familiar with coding, you don’t have to worry.

You can still add this feature into your site.

Just follow my lead.

If you are using a free WordPress theme,

Then check your theme settings whether or not it has a section to add custom javascript.

Most premium themes on ThemeForest has this feature built-in.

But if you do not have that kind of functionality built into your theme,

You can just simply add a WordPress plugin named Insert Headers and Footers to avail of this feature.

It is really a lightweight plugin,

So don’t worry about the site slow down.

After installing the plugin you have to navigate through Settings -> Insert Headers and Footers.

And then, paste the code provided below under the section named “Scripts in Footer”.

For Pro Techy Users

Well, if you are a pro user I’m assuming that you are already using a custom theme or a child theme in some way.

And, I’m also assuming that you also have added a custom JS file for your custom theme.

If you haven’t then please add a custom JS file into your theme assets folder.

And then, in your theme’s function.php add a wp_enqueue_script call to load your custom JS file.

Now within the custom JS file,

You just have to paste the following code to make things work.

It’s that simple.

The code for Custom Tracking

Here is the code that you have to add to your website to start the AdBlock enabled users tracking process.

Make sure you copy and paste it properly.

Also please note as this is a free script,

It doesn’t come with any warranty or support included.

jQuery(function ($) {
/*Checking Adblock enabled and pushing it to analytics*/
if ($(".adsbygoogle").length > 0 ){
if (typeof(window.google_jobrunner) === "undefined") {
__gaTracker('send', 'event', 'Adblock', 'Blocked', {'nonInteracion':1});
} else {
__gaTracker('send', 'event', 'Adblock', 'Unblocked', {'nonInteracion':1});

How to check these tracking results?

It’s very easy to get the tracking data from your Google Analytics account.

Just login to your Google Analytics account,

Head over to the Real-Time section (on the left bar) and you will see a sub-menu called Events here.

From this section,

You can track your real-time users’ live,

Like how many current visitors have AdBlock enabled on their browser.

You can also head over to the Behavior section and click on the Events section to get a long time report like month-wise or year wise.



  • What is your opinion about using AdBlock and tracking AdBlock users?
  • Do you use any sorts of AdBlock Tracking in your site besides what I’ve shown above?
  • Do you have any better idea of handling Adblock users without violating AdSense policy or the overall user experience?

I would love to hear them in the comment section below.

This post has not ended here, we can still carry on this conversation in the comment section if you want.

Feel free to subscribe to my blog for more awesome articles like this and also please don’t forget to share this post with others which might help them to save hours figuring out this on their own.

Written by Vishal Rana

Founder and Editor-in-Chief of 'PresentBlogging'. Grey Hat Hacker, Cyber Security Consultant, Information Security Researcher, Programmer, Developer, Social Engineer, Penetration Tester, Professional Blogger and SEO expert.


Leave a Reply

Your email address will not be published. Required fields are marked *





How to Place Adsense Ads Anywhere In WordPress Blog

How to Place Adsense Ads Anywhere In WordPress Blog?

How to Become a Successful Blogger Like Pro

How to Become a Successful Blogger Like Pro?