Detecting Adblock Users On Your WordPress Site

It’s understandable that some internet users might want to tone down the number of ads on certain websites. After all, it’s a plus that visitors want to focus on your content over promotional messages. However, as a blogger, you might be losing revenue because of this. 

Fortunately, there are several ways to work around ad-blocking software. This may give you a better chance of maintaining your revenue streams, and you can continue to focus on generating engaging content.

In this post, we’ll provide you with an understanding of how AdBlock software works. We’ll also share some tips on how to detect whether someone is using it and what you can do about it. Let’s dive in! 

How Does AdBlock Work?

Most ad-blocking software is designed around filters. Essentially, when someone using this type of tool visits your website, it scans the information returned from your server. If it finds anything that matches an item on its list of content to filter out, then that element won’t be displayed.

AdBlock is a valuable tool for many web users and is often added as a browser extension. For example, it can be helpful for those who do a lot of online research. Not only can it enable webpages to load faster, but it can also conserve bandwidth and battery life. 

However, there are some downsides to this trend for content creators as well as brands who pay you to promote their products. In 2019, over 25 percent of all internet users had ad-blocking software. The financial impact of this is fairly significant.  

Additionally, ad-blocking software could be removing Call-to-Action (CTA) boxes, images, or buttons on your pages. If the tool detects any of these elements by filtering file names or keywords related to advertising, then they can be targeted even though they’re not true promotions.

Detect AdBlock with Javascript

Fortunately, you can often counteract the loss of revenue to software such as AdBlock. For example, there are several ways to detect its use with WordPress, including adding some Javascript to your site. It’s worth noting this method takes some coding know-how. We’ll cover alternative solutions later.

Step 1: Create a Javascript File

One way to detect AdBlock users on your WordPress website is to create and reference a JavaScript file called adframe.js. The software will read this as a promotion and attempt to filter it out, which will then trigger a message for your users that they aren’t seeing all your content. 

First, create a file called adframe.js and add the following line of code:

var adblock = false;

Then save the file to your server using a File Transfer Protocol (FTP) client such as FileZilla. Its name will make AdBlock attempt to prevent adframe.js from loading, and the next step below will enable you to alert visitors to this.

Step 2: Modify Your header.php File

Next, you’ll need to reference the JavaScript file you created in your site’s header to send the message informing AdBlock users they’re missing out on your content. This requires inserting some code to your theme’s header.php file. We recommend using a child theme to avoid losing your changes during updates.

You can make the necessary modifications with an FTP client and your favorite code editor, or in your WordPress dashboard by navigating to Appearance > Theme Editor: 

From here you can access the files for your active theme. You’ll find Theme Header on the right side of the editor: 

Click on it, then add the following scripts within the <head></head> tags:

<script type="text/javascript">
 var adblock = true;
<script type="text/javascript" src="adframe.js"></script>
<script type="text/javascript">
 alert("Please Disable AdBlocker To View The Page");

You can craft your own text for the message by replacing “Please Disable AdBlocker To View The Page” with a custom notification. 

Step 3: Hide Content From AdBlock Users 

It’s really up to you whether you want to completely hide all your content from anyone using AdBlock. There is a bit of a debate regarding this approach. Some argue that if you employ conscientious advertising methods, you shouldn’t need to worry about this type of software. 

It’s important to remember that forcing someone to turn AdBlock off in order to view your content does not always work in your favor. The user is just as likely to abandon your site, rather than disable the extension. We recommend investigating other monetization options if you’re not sure about hiding your pages.

AdBlock Detector Plugins

If dealing with AdBlock manually is not your cup of tea, there are also a few WordPress plugins available for handling this task. It’s worth noting that there are only a few we recommend, as many created for this purpose have not been updated recently.

1. Ad Blocker Notify Lite

Ad Blocker Notify Lite provides an easy-to-use detection interface for your website. While it doesn’t prevent users from accessing your content, it does offer multiple options for alerting them. You’ll be able to view statistics and a visitor counter in a widgetized dashboard as well. 

The free version has enough features to get you started. You can choose from compliant, aggressive, or transparent approaches to notify your users that their AdBlock software means they’re missing out on some of your content. Pricing for the premium version is packaged with other products from the developer. 

2. Ad Inserter

Another option is to look at a more comprehensive plugin solution. Ad Inserter can handle all your promotion-related needs and comes with AdBlock detection and notification features. 

With the free version, you’ll be able to detect users who are preventing promotional content from loading. However, to use notifications, replacements, or other related functionality, you’ll need to upgrade to the pro version. It starts at $22 for use on two websites and includes free updates for a year. 

What If AdBlock Is Detected?

We’ve covered several approaches to detecting AdBlock on your WordPress website. Deciding what to do if a visitor is using AdBlock is really up to you. We’ve looked at three paths you might take below.

1. Allow AdBlock Users On-Site (Do Nothing)

The option we recommend is essentially to do nothing. While it’s tempting to try to preserve your revenue by turning AdBlock users away, you don’t want to miss out on traffic. Plus, not all applications follow the same protocols. What works to keep out users of one may not work for another. 

That being said, there’s little harm in letting AdBlock users onto your website. You detect they’re preventing some elements from loading you can serve up alternative content in those spaces instead. This can get tricky, but it’s an approach worth trying if you have the programming resources. 

2. Send a Prompt

We covered this option when we discussed inserting some JavaScript into your website files or using a plugin to detect AdBlock users. This is a pretty compliant and balanced approach. It simply sends users a notification that some of your content is not viewable due to their ad-blocking software. 

Alternatively, users faced with a popup might just leave and not come back. For this reason, it’s not our first choice. Visitors install AdBlock for a reason, and if your website is aggressively promotion-heavy, further aggravating them won’t likely be beneficial to you.

3. Block AdBlock traffic

As anti-AdBlock options evolve, so do the ad-blocking applications. This can make it difficult to maintain strategies to circumvent them. Methods used in the past may become defunct as software for filtering out promotions is updated.

That said, there are ways to completely prevent traffic from users with AdBlock installed. You can find set notifications asking them to whitelist your site or turn off their extension. However, if your posts aren’t engaging enough to attract visitors who are strongly opposed to promotional content, this isn’t likely to benefit you much.

Grow Your Digital Business With WP Engine

Tackling problems that might arise due to AdBlock can be easier with expert developer resources. Ultimately, it’s vital that your website provides a high quality digital experience for all of your visitors so that you can land conversions and grow your income, even without ad revenue.

Here at WP Engine, we offer many web hosting plans and eCommerce solutions to help you create the best experience for your visitors. Check out our options for your next project and gain access to our expert WordPress professionals today! 

Get started.

Build faster, protect your brand, and grow your business with a WordPress platform built to power remarkable online experiences.