Publishers and advertisers have many tools to promote their products online. With tracking options, like cookies, they can identify users through many devices.

It is possible to understand a customer’s behavior from when they click on an ad until they place an order.

Thus, advertisers can release marketing campaigns, create targeted ads, and segment an audience. Yet, this is becoming a hard task.

Privacy laws are getting stricter and many users install ad blockers.

Anti ad software can seriously affect a marketing campaign. So advertisers need to understand how this technology works.

This will enable them to optimize their strategies.

First, they need to detect which users have an ad blocker installed. Knowing this, they can estimate the losses and prevent them in the future.

This approach can help optimize marketing efforts and improve a company’s performance.

How do websites detect AdBlock? This article analyses how such software works.

It is valuable information for advertisers who want to cut losses and boost revenue.

How does Adblock detection work?

How does Adblock detection work?

The purpose of an ad blocker is to block advertisements when navigating web pages. They are browser extensions or plugins.

They filter different server addresses analyzing their patterns. They block communication with ad servers and hide site elements that display ads.

Some browsers block ads by default and users can add extra blocking filters. This is the case with Google Chrome.

The ad-blocking process starts as soon as the web page begins to load on the server. An ad blocker scans the website’s scripts and compares them to a database.

If it finds scripts that match those in the database, the software prevents them from loading. It works with a database of ad-related scripts and can understand where the annoying ads are.

The next step is to block them. The user will see a blank space instead of the ad design.

Why use an ad blocker?

Users install this software for a variety of reasons. They may have concerns about tracking processes and want to keep their information private.

In other cases, they want to avoid tiresome advertisements. Sometimes, they simply want a larger bandwidth.

There are some very popular ad-blocking software on the market. These include uBlock, Brave, AdBlock, and AdBlock plus.

Adblock detection: how to detect ad-blocking

There are methods to prevent advertisement blocking. Companies like Forbes and Business Insider use anti-Adblock methods.

This software works by analyzing a website and its scripts. Thus, it forms a previous image of what the web page will be like when loaded.

Once loaded, the software compares the expected page with the rendered version. If these don’t match, the website sends an anti-ad-blocking message.

The software throws a code that works as a ‘bait’ for ad blockers. This is a piece of code that appears to have advertising elements.

It is generally a hidden div. It contains a file, like ‘ads.js’, that’s usually the target of adblockers.

When the ad blocker ‘bites’ the bait, the system releases an ad blocker message alert. How does this work?

When a browser extension tries to block the “ad”, the bait modifies the rendering version of the site. This can help identify the presence of a plugin or extension blocking ads.

The ad-blocking tactics are usually shared across the web. This information can also be useful for creating baits.

The following is an example of a ‘bait’ code:


By reading ‘banner_ad’ in the code, the browser will release an ad blocker. Many ad-blocking lists carry this text.

These lists include references to JavaScript files and CSS stylesheets.

Ad blockers compare a site’s scripts with the ones from this list. When it finds a match, it prevents the script from loading.

Yet anti-ad blocker software also uses this information to create baits. Anti ad-blocking works effectively and helps publishers mitigate their losses.

The first step is to detect where ad blockers are. After this, publishers can take different measures.

We can help you turn your idea into reality, take over your existing project, or extend your current development team.

Schedule a free consultation at, or fill out the form and we will follow up with you shortly.

What measures to take after ad-block detection

  • Ask for a voluntary donation to help create quality content.
  • Ask users to white list the site or remove ad blocking for this page.
  • Block access to the page’s content.
  • Offer users a paid subscription free of ads.
  • Offer an ad-free experience in exchange for social media engagement or email signup.

Anti-Ad-Blocking Scripts

Anti-Adblock technology has become a successful business. Many companies offer anti-ad-blocking codes, plugins, and apps.

However, it is still possible to find free options online. Next is a list of scripts that can be used to detect ad blockers.


One of the easiest ways to detect an ad blocker is the use of ‘bait’. Sending a code that is similar to an ad-based script can reveal the anti-ad elements.

A piece of code that will trigger an ad alert is ‘ads.js’. saves a piece of Javascript code and creates a hidden section (div) to a file called ‘ads.js’. It places this in the root directory o a user’s website.

Publishers insert the following piece of Javascript code into their HTML base:

<script src="/ads.js"


<script type="text/javascript"><br />

if(document.getElementById('RZfrHsidDwbG')){<br />

alert('Blocking Ads: No');<br />

} else {<br />

alert('Blocking Ads: Yes');<br />

}<br />


This code checks if there is a hidden ‘div’ in the targeted website, allowing ads to display. If there is not a ‘div’, this means that ads are blocked.

IAB Script

The Interactive Advertising Bureau aims to overcome the difficulties of today’s marketing. It consists of publishers and ad technology companies dedicated to research and development.

They have created the IAB ad-block detection script. This code has had successful testing on Chrome, Safari, Firefox, and Explorer.

Readers can access the IAB description and installation instructions here.

How to recover revenue losses caused by ad blockers?

While ad blocking is an excellent tool, it may not be the best option for every publisher.

Every advertiser needs to consider today’s diverse market and its constant innovations. Thus, it will be possible to choose the best suitable option.

Here are a few ways a publisher can recover revenue in a post-ad-blocker world.

Ad Reinsertion

This allows publishers to display acceptable ads on sites using an ad blocker.

This may be the least ethical of all the anti-ad-blocking strategies. It ignores the user’s desire to receive no advertisements.

Ad reinsertion technology requires marketing companies to be whitelisted by ad blocker creators. This requires constant updating on the publisher’s side and it brings little benefit.

After all, if the user is choosing to install an ad-blocker, they won’t be likely to click the reinserted ads.

Native Ads

Native Ads

Native ads are an excellent option for optimizing a marketing campaign. They are well blended with the site’s content, hence they are hard to detect using ad blockers.

An example of native ads are the sponsored posts a person can see on Facebook. They work so well that they are being used by news websites and online magazines.

Though hard to detect by ad blockers, they are not impossible to find and may still get blocked.


Engaging with ad-block users can be an excellent strategy. Publishers can offer many options.

They can try to find out what specific ads the user is not fond of and provide a solution.

If the user has an interest in the content, publishers can offer an ad-free paid subscription. They can also ask for the user to ‘whitelist’ them.

If users dislike a specific advertising format, publishers can offer a new website version. It can display a page with vetted ads or ads subject to certain guidelines.

Ad-free subscriptions

This is an excellent approach for news sites or bloggers. A website with lots of content can use advertisements to get subscribers.

Publishers and blog admins can offer an ad-free reading experience for a subscription.

For these websites, content is the main product. Hence, users are likely to pay a subscription to enjoy this content ad-free.

Ending thoughts on how do websites detect AdBlock

Advertisers need to understand the user’s rights. Each user has the right to a superb web experience.

Today they have many tools to help them achieve this.

Before asking ‘How do websites detect AdBlock?’, it is important to understand why they appear.

What leads website users to install an ad blocker? What reasoning is there behind this decision?

By understanding this, advertisers can offer users the experience they deserve. In many cases, they can also offer the product the user is looking for.

But an aggressive marketing campaign can push the customer away.

The online advertising industry is responsible for scam popups, malware, and annoying ads. In this context, it is no surprise that users are installing more ad blockers by the day.

Ad-blocking software can bring benefits for both parties. Thanks to these, advertisers can understand a user’s preference.

They can provide a better experience and deliver personalized ad campaigns.

The best marketing strategy is to respect the privacy of the consumer. Customize the content and offer an outstanding user experience.

Looking for a development partner?

If you’re looking for a technology partner, development team augmentation, or just a company for your software&app development initiatives, consider TMS.

TMS is a software and digital company in Belgrade, Serbia. We develop innovative and modern software.

A few examples include premium booking software Trafft, MedTech apps like MR Prepare, or MarTech/AdTech apps like the Advise Media Suite, among other great software examples.

Check out our services and also some of the work we’ve done for our clients. Who knows, maybe we’ll form a successful relationship.

Schedule a free consultation at, or fill out the form and we will follow up with you shortly.

If you enjoyed reading this article about how do websites detect AdBlock, you should check out this one about what is AdTech.

We also wrote about a few related subjects like behavioral targetingMVP testspersonalization algorithms, how to hire a web development teamsoftware development budget, device fingerprinting, cross-device attribution, proof of concept vs prototype, and what is MadTech.