How To Detect Ad Blockers

Brock Munro
May 20, 2021
April 23, 2024
How To Detect Ad Blockers

Ad blockers- software that users install to remove ads from their web experience- are more popular than ever, with Statista data showing ad blockers’ penetration increased from 15.7% in 2014 to 27% in 2021 in the US alone.

Adblocking technology has created a virtual tug of war between digital publishers and website users resistant to ads in their web experience. 

While users have no way of completely rendering ad blockers invisible to publishers, so too, publishers cannot consistently make their websites immune to ad blockers.

For publishers, ad blocking software ultimately leads to a loss of revenue. To calculate the exact financial effect of ad blocking software, digital publishers need the ability to detect when people are using an ad blocker. Once they have detected which users are blocking ads, they can begin to mitigate the damage and recover lost revenue.

This article covers the basics of ad-blocking software, how it works and how site owners can reduce the negative impact of ad blocker technology.


How do Ad Blockers Work?

How do Ad Blockers Work?

Ad blockers are browser extensions or plugins that disable ads on specific web pages. An ad blocker works by blocking communications to ad servers and then hiding the elements of the web page that are designed to display advertising content. Ad blockers perform this function by referring to filter lists containing the addresses of all known ad servers along with vast sequences of pattern matching rules.

For users who have an ad blocker installed, the space where the ad creative would usually appear will now be simply a blank space.

Ad blockers start working the minute a page starts loading in the browser. When an ad blocker browser extension or plugin is installed on a user’s computer, the ad blocker quickly scans any web page the user navigate for scripts. These scripts are then compared to a database of known ad scripts. If any of the scripts match, these ads will be blocked from being displayed.

While ad blockers are undeniably painful for publishers, the benefits to users are plain to see. Along with reducing page load time, they also remove what are often deemed by users as annoying ads.

If publishers can't find a way to convince web users to stop using ad blockers, how can they best conduct ad blocker detection to ensure minimal loss to revenue and maximum return on investment for advertisers?


How Can Publishers Detect an Ad Blocker?

Even if publishers are getting a decent ROI for the advertising efforts, if they are encountering ad blocker extensions- which it is almost certain they are- they are losing valuable marketing revenue. As ad-blocking technology has expanded, so too has anti-ad block technology. There are now several known applications, plugins, and JavaScript codes that publishers can use for ad block detection.


Bait Content

Ad blocking works by placing what is known as 'bait content' within the pages of a website. Although this bait content is invisible to users-often being as small as a pixel in size, this code appears to ad blockers as advertising content. After a web page has finished loading, the ad blocking code checks the properties of the bait content to ascertain whether it is still visible. If the bait content has been hidden, the detection code knows that an ad blocker is active.

A simple example of bait content is as follows:


<div class="banner_ad"> </div>

In the above example, the attention of most ad blockers is drawn to the class name of “banner_ad,” which can be found within most ad blocker blacklists. 

For publishers not confident in writing their own script looking for an easily implementable adblock detection script, the following are readily available online and should easily integrate into their web pages.


Ad Block Detection Scripts

IAB Script

lnteractive Advertising Bureau AdBlock Detection GitHub page

The Interactive Advertising Bureau (IAB) is an independent, international, research and development consortium comprised of digital publishers and ad technology firms. IAB Tech Lab aims to reduce friction associated with the digital advertising and marketing supply chain. From this mission was borne the IAB ad-block detection script.

The IAB ad-block javascript has been tested on Chrome, Firefox, Internet Explorer and Safari Browser. 

Publishers can access the script and all the installation details on IAB’s GitHub page.




DetectAdBlock aims to simplify the process of ad-blocking detection in the following three straightforward steps.

Step 1: Publishers should start by  creating a hidden ‘div’ section in a file called “ads.js” and then place it in the root directory of their website, which will look like the following javascript code:

var e=document.createElement('div');'mnMzPGBywKre';'none';


Step 2: Next, publishers should place their ad block detection code in the HTML source code, above the body code. The express purpose of this code is to detect if “ads.js” exists (ads are allowed) or not (ads are blocked):

<script src=”/ads.js” type=”text/javascript”></script>

<script type=”text/javascript”>


 alert(‘Blocking Ads: No’);

} else {

 alert(‘Blocking Ads: Yes’);



Step 3: Finally, publishers can add a message directing to disable the ad blocker and display the ad content in question.




F**kAdBlock is a more formalized ad blocking detection code, developed by the online community also known as BlockAdBlock. Publishers can reference the F**kAdBlock GitHub page for the code and example implementation.


What Publishers Can Do After Detecting Ad Blockers

Around 30% of publishers are now using scripts to detect ad blockers. But where to next? With adopters of ad blockers clearly adverse to display ads, how can publishers navigate this, with the aim of both reclaiming potentially lost revenue while also ensuring not to alienate site visitors?

The answer lies in putting the power back in the hands of the users. Renowned publishers such as Forbes and Business Insider do this by displaying anti ad blocking messages. Anti ad messages pop up in the users’ browser requesting their permission to display ads by agreeing to disable their ad blocker.

Perhaps surprisingly, data shows that the simple fact of handing the choice back to the user,  means around 50% of users will agree to disable their ad blocker to view the advertiser’s content.


Alternatives to Anti-Ad Block Technology

With an ever-increasingly diverse digital ecosystem, anti-ad block technology may not be the best option for every publisher. Web admins may want to look at other alternatives to increase marketing monetization in a post-ad-block world.


Ad Reinsertion

One option available to website owners is ad reinsertion technology. This technology is an emerging method that involves advertisers serving what are deemed ‘acceptable ads’ to browsers actively using an ad blocker. This is perhaps the least ethical anti-ad blocking technology, as it ignores the ‘please don’t advertise to me’ message. 

Ad reinsertion also requires ad tech partners to be whitelisted by ad block creators and may need constant updating on the publisher’s behalf for ultimately minimal benefit.

Publift has this technology implemented within our Ad tags allowing for customers to serve Acceptable ads to Adblock users, generating incremental revenue on users that were previously non monetizable.

Native Advertising

Native ads are another effective way to circumvent adblock tech on a website. Native ads are designed to resemble the other content on the website. In this way, in-feed ads are difficult for adblock software to detect, as they match the editorial content in form and function.

Sponsored posts on social media sites such as Facebook, Instagram, Twitter, and LinkedIn are examples of how native advertising can be used to monetize content.

‘Ad Free’ Subscriptions

Publishers and bloggers with content-rich websites should consider offering ‘ad free’ subscriptions. For news sites, their content is their product, so ads are an essential part of their revenue-raising strategy. Offering an ad-free news experience will often appeal to users of these sites, particularly in the mobile environment.

Talk to Users

Finally, publishers should consider simply asking their users to turn off their ad blocking software. By explaining that ads allow the website to continue operating and paying its staff, users will often willingly disable their ad blocker, particularly for websites that offer a superior user experience with free and valuable content.

Key Takeaways

When evaluating how to work around adblock software, publishers and advertisers must keep in mind that users have the right to use any plugin or extension they choose to enhance their web experience. 

Adblockers exist because pop-ups, malvertising, redirect ads, and spam are creating a web experience that is distracting and annoying to the user.

By looking at their client base, publishers can employ a range of strategies to work around adblock technology and continue to monetize their content.

As a Google Certified Publishing Partner, the team at Publift are experienced in assisting publishers, and advertisers monetize their content for maximum return on investment. Contact our friendly team today to learn more.

If you’re making more than $2,000 in monthly ad revenue, contact us today to learn more about how Publift can help increase your ad revenue and best optimize the ad space available on your website or app.

Grow with us

Grow your business with a sustainable, long term partnership. If you're making more than $2,000 in monthly ad revenue, contact us today to boost your revenue with our all-in-one solution.
Laptop screen with web page open

Success Stories