WordPress Tutorial

How to Track AdBlock Users in WordPress with Google Analytics

AdBlock

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

Since the day AdBlocking service has been released it has become the nightmare of all content creators, which is obvious as content creator spend hours on researching things and building up great content. But the problem is not all content creators are good, some of them has 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 gets frustrated and starts using disgusting ad services just to earn a few penny.

AdBlock was created to save users from those annoying ads that we all hate. Last month I did an international survey where 82% 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 love 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 a lazy being. It’s not like that they don’t wanna whitelist your site, it’s just they are too lazy to do it.

How to Track AdBlock Users

A few months back I write 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 though Google Analytics. As you can gather all the information about your users depending upon their adblock status and even generate custom report to take 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

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

  • You must 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. Just decreases user experience with annoying ads.
  • This script will only work if you are using the asynchronous version of Google Adsense code. If you are not using that, then you should upgrade now as it highly reduces page load time.
  • You must 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 is 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 may be 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 theses 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 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 in 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 has AdBlock enabled on their browser.

AdBlock enabled

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.

Feedback

So, 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 showed 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 is 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 by their own.

Comments

Most Popular

To Top