Adblock Detection Script

Unsurprisingly, publishers aim to make money from every website visit. The bad news (for publishers) is that various ad-blocking plugins and browser extensions may noticeably reduce a publisher's revenue since they remove or block ad codes.

One of the simplest but most efficient solutions is the installation of an Adblock Detection Script on your website. It must help mitigate ad-blocking software's negative impact and keep your revenue growing.

You may have encountered warning messages stating "Adblock Detected" and requesting users to turn off their ad blockers (or whitelist a domain) to proceed. Certain publishers also prohibit access to their content if an ad blocker is enabled.

It's understandable why blog posts and articles are offered for free since publishers generate revenue by displaying advertisements alongside the content. Sadly, many internet users don't respect content creators' afford and want to get everything for free.

Below, we share several ideas on preventing blocking ads on your website, including our adblock detection scripts.

Ad block detection

Different detection strategies exist, but we have chosen the simplest but reliable method based on CSS bait.

This method involves generating a DIV likely to be blocked by ad blockers due to its class name. We can determine if an ad blocker is currently in use by checking whether the DIV has been hidden.

There are several benefits of using this approach instead of more complex solutions:

  • The method involves using class names as bait, which prevents extra HTTP requests that may slow down the pages
  • The detection is extremely quick and asynchronously
  • It only takes a few lines of code
  • The detector returns either true or false


You can download AdBlock Detection Script from our GitHub repository at

White Label Ad Server

When ad-serving domains are white-labeled, ads are displayed from the sub-domains of the same domain as the main content. This reduces the chances of blocking the domain, which would also block the main content.

By default, ad servers use shared domains for all customers, in order to bypass ad blockers, publishers require a white label ad server. The white label option allows you to customize domains involved in the ad-serving process.

Low Ads Quality

We must acknowledge the truth that people use ad blockers primarily because:

  • ads can be bothersome or intrusive
  • ads may potentially contain harmful viruses
  • ads may contain unmuted auto-playing videos

It is important for publishers to monitor the quality of ads appearing on their websites consistently. Ads of high quality receive more clicks from end-users, ultimately increasing the value of the ad zones on a website. Besides, publishing high-quality ads decreases the probability of including your domains in the block lists.

In Summary

Ad-blocking plugins and browser extensions can significantly reduce a publisher's revenue by blocking ad codes. An effective solution is to install an Adblock Detection Script on the website, prompting users to turn off their ad blockers. Another approach is using a white-label ad server to display ads from custom domains, reducing the chance of blocking. Besides, publishers should regularly monitor the quality of ads and strive for high-quality content.