Home Guides and Tutorials Ad Blocker Detection: Tools and Techniques for Publishers

Ad Blocker Detection: Tools and Techniques for Publishers

by Chisom Maduonuorah

Ad blockers are as popular as ever, with 912 million users as of 2023, compared to just 54 million a decade before. This expanding usage presents a problem for website publishers, who now get lower revenues from their ad-based sites. 

However, publishers can mitigate this issue via ad block detection. This entails installing scripts that recognize ad blockers and ask users to disable them before accessing their content. This guide explores how publishers can use ad block detection tools to boost their revenue.

How ad blockers work?

Ad blockers are browser extensions that disable ads on websites. They do this by blocking communication between ad servers and the user’s web browser. They also hide the visual elements designed to display ads on a website.

Suppose you’re a publisher using an ad network to serve ads on your website. The ads come from the network’s ad servers. An ad blocker prevents communication between those ad servers and a user’s browser so that the ads won’t appear. Instead, the user sees a blank space where there’s meant to be an ad.

how-ad-blockers-work

Ad blockers cause publishers to lose revenue. However, ad networks know this and use sophisticated technology to detect and counter ad blockers. For example, Adsterra provides an anti-adblock feature that helps boost publishers’ revenue by up to 30%. As a publisher, choosing an ad network with advanced anti-adblock technology is crucial to your success.

Adsterra’s anti-ad block script significantly boosts your website revenue. Better off, you get access to 15,000+ high-quality advertisers and counting. Monetization is one click away.

GET ANTI-AD BLOCK
To Contents ↑

Why do users install ad blockers?

People install ad blockers to avoid seeing too many ads. Sometimes, you can’t blame them, because some publishers insert excessive ads that annoy readers. As a publisher, you need creative ad formats that promote offers yet minimize distraction. For example, Adsterra’s Interstitial (full-screen) ads only show after a user clicks a “close” button, not when reading content. 

Ads can feel intrusive, especially those based on the user’s browsing history. Hence, many install ad blockers to avoid being monitored and served personalized ads. These ad blockers impact publishers’ revenue, including for publishers not guilty of serving intrusive ads. You can mitigate this impact by using an ad block detector. 

As a publisher, it’s advisable to place ads correctly to reduce the risks of more people installing ad blockers. Your web pages shouldn’t be covered with excessive ads. Instead, aim for a 30% to 70% ratio of ads to content. The top, bottom, or side of a web page is ideal for placing ads.

To Contents ↑

How can publishers detect an adblocker?

Publishers can detect ad blockers in several ways. The most common is adding ad blocking scripts to a website, which recognize an ad blocker trying to cut off communication from the ad server. You can also install a plugin that detects page elements inserted by ad blockers. Let’s dive deeper into these methods below.

Ad block detection scripts

Scripts are lines of code you insert into a web page’s backend. The code isn’t visible to a user but performs vital functions. In this case, you can add a script to scan a user’s browser for ad blocking signs and raise an alarm if detected. Let’s explore these scripts below.

Detect Adblock

Detect Adblock is an effective ad block detection script for websites. It detects ad blockers by looking for a specific line of code commonly found in these blockers. 

Detect Adblock provides a straightforward tutorial to insert its ad blocker detection code on your website. Follow the steps below, as sourced from the official Detect Adblock guide.

Step 1: Create a hidden “div” section in a file named “popup2.js” and place it in your website’s root directory. “popup2.js” is the common name for JavaScript files that serve ads on a web page.

You can create the section by adding the below code to your website:

var e=document.createElement('div');
e.id='vhCJondmTYta';
e.style.display='none';
document.body.appendChild(e);

Step 2: Place the below JavaScript code in your website’s HTML source code, just above the </body> tag.

<script src="/popup2.js" type="text/javascript"></script>
<script type="text/javascript">

if(document.getElementById('vhCJondmTYta')){
  alert('Blocking Ads: No');
} else {
  alert('Blocking Ads: Yes');
}

</script>
</body>

This code checks whether the hidden div created within “popup2.js” exists (ads are permitted) or not (ads are blocked).

Step 3: You can add a friendly message directing users to turn off their ad blocker (when the script detects one). Below is a code sample for this friendly message:

<style>
#uDpsnWeSmtxq {
display: none;
margin-bottom: 30px;
padding: 20px 10px;
background: #D30000;
text-align: center;
font-weight: bold;
color: #fff;
border-radius: 5px;
}
</style>

<div id="uDpsnWeSmtxq">
  Our website is funded by displaying online advertisements to our visitors.<br>
  Please consider supporting us by disabling your ad blocker so that we can earn revenue to provide more content.
</div>

<script src="/popup2.js" type="text/javascript"></script>
<script type="text/javascript">

if(!document.getElementById('vhCJondmTYta')){
  document.getElementById('uDpsnWeSmtxq').style.display='block';
}

</script>

The above script displays the bolded words in a popup menu, telling the user that your website relies on ads and that they should consider disabling their ad blocker to support your efforts.

To Contents ↑

IAB Script

IAB is an abbreviation for the Interactive Advertising Bureau, an organization that provides legal and technical support for the digital advertising industry. This organization houses the IAB Technology Lab, which provides technical solutions for digital media outlets. It developed the IAB ad block detection script that works on popular browsers like Chrome, Firefox, and Safari.

Publishers can access the IAB ad block script on GitHub. It’s free to use, and the GitHub page includes instructions to install it on your website. The script works by creating visual elements likely to be hidden by ad blocking tools. If a user’s browser hides these elements, it signals that they use an ad blocker.

To Contents ↑

F**kAdBlock

F**kAdBlock is an open-source ad blocking script. It works by inserting a dummy “div” section on a web page that contains css classes and styles common with advertisements. Then, it checks if the user’s browser has hidden this div section from view. If so, it signals that an ad blocker is enabled on the viewer’s browser.

This ad blocking script is free to use and available on GitHub. It works with popular browsers including Google Chrome, Firefox, Opera, Safari, and Internet Explorer. Below is an example of the F**kAdBlock script that runs on a website:

script-example-for-website
Source: F**kAdBlock
To Contents ↑

Alternative ways to counter ad blockers

Ad reinsertion

Ad reinsertion is an emerging technology that lets publishers serve ads to browsers running an ad blocker. It works by placing a reinsertion script on your website. This script detects when a user’s browser has blocked an ad. Then, it activates an advertisement from an alternative server to fill in the space, hoping the new ad won’t be blocked.

However, this technique isn’t always successful, as ad blockers can quickly identify and cut off new ad servers. It requires playing “cat and mouse” with ad blockers, which can be strenuous for small publishers.

Native ads

Your website can display native ads that are not loaded from an external server. Instead, the ad comprises a picture or video uploaded directly to your website server. An ad blocker won’t hide this ad because it’s part of your website’s native content, i.e., it loads from the same server hosting the website.

Native ads are best suited for big publishers who negotiate advertising deals directly with brands. Small publishers overwhelmingly depend on ad networks, which serve ads from external servers. As a small publisher, your best bet is choosing a network like Adsterra with reliable anti-ad blocking technology. 

35,000+ publishers monetize their content with Adsterra and have access to our advanced anti-ad blocking technology. Join now to increase your ad revenue.

BOOST REVENUE
To Contents ↑

What to do after detecting ad blockers?

After detecting an ad blocker, the ideal action is politely asking users to turn it off. You can explain that your website depends on ads, so using an ad blocker affects your revenue. A loyal reader can empathize and temporarily pause their ad blocker to access your content.

Refer to the earlier Detect Adblock section for a script displaying a polite message asking users to turn off their ad blocker. Also, here’s a sample image to give you a clue:

You can also install an anti-ad blocking tool on your website, in case some users don’t oblige to the polite message. This tool mandates users pausing their ad blockers before reading your content, helping you claim lost revenue. Refer to earlier sections of this article for instructions on installing anti-ad blockers.

To Contents ↑

Conclusion

Ad blocker detection helps maximize your revenue. We’ve explained how to use web scripts to detect and thwart ad blockers. Yet, an easier method is choosing an ad network with built-in anti-ad blocking tools. 

Adsterra uses advanced anti-ad blocking techniques to increase publishers’ revenue by up to 30%. We also offer creative ad formats like Direct Link and In-Page Push that bypass ad blockers. Monetization is just a few steps away with Adsterra.

MONETIZE NOW

Related Posts
×