How to detect Adblocker in WordPress

Do you want to prevent Adblockers on your Wordpress website and boost your earnings, then this article is for you.

In this article, I will show you the easiest way of detecting Adblocker in Wordpress and forcing users to disable adblocker on your website.

So, what is Adblocker, and why you should use an Anti Adblocker script on your Website?

Well, Adblockers are mostly browser extensions that are designed to block ads on a page and load pages without ad codes.

So, if a user uses an Adblocker extension on their website then the ads will not display to that user and you will not get any ad click or impression from that person’s visit. Eventually, it may affect your overall ad income on that website.

It is now a serious issue as more people are now using this to have a clean experience but it is not good for creators like us whose websites mostly rely on Ad income.

Even very big popular websites like Google, YouTube, Facebook are mostly relying on Ads. As a content creator, you can ask your audience to disable ads on your website. As the content is free, users should not have any issue seeing some ads.

Recently, I have published a video on how to add anti adblock script in Blogger and some people request me to make a tutorial on how to implement it on the Wordpress website. So, follow the step-by-step tutorials below.

YouTube video

How to Install Anti Adblock script in Wordpress?

  1. To install the anti adblock script in Wordpress, login to your dashboard and go to Appearance > Theme File editor.
  2. Now open the Footer.php file and search for </body> tag.
  3. After that paste the script just above it.
  4. Then update the theme code and it is done.
Add anti AdBlock script in WordPress theme editor
<style>
.note{position:relative;padding:20px 30px 20px 50px;background-color:#e1f5fe;color:#01579b;font-size:.85rem;line-height:1.62em;border-radius:2px}
.note:before{content:'\2605';position:absolute;left:18px;font-size:20px}
.noteAlert{background-color:#ffdfdf;color:#e65151}
.noteAlert:before{content:'\2691'}
</style>
<script>//<![CDATA[ 
!function() {function f() {var a=document.getElementById("main");a.innerHTML='<p class="note noteAlert blocked"><strong>Ad-Block Detected :((</strong><br><br>Sorry, We detected that you have activated Ad-Blocker. <br> Please Consider supporting us by disabling your Ad-Blocker,It helps us in maintaining this website. <br>To View the content disable adblocker and refresh the page.<br><br>Thank You !!!</p>';} var b=document.createElement("script");b.type="text/javascript";b.async=!0;b.src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js";b.onerror=function() {f();window.adblock=!0};var e=document.getElementsByTagName("script")[0];e.parentNode.insertBefore(b,e)}(); 
//]]></script>

Note: If the above code is not working then you have to replace the id (i.e. main) of your main content that is used on your theme.

If you don’t want to add it to the theme file editor, then you can add a code manager plugin like Header Footer code Manager to your website.

Header-Footer-Code-Manager-WordPress-plugin

Using this plugin you can add the code in the footer section of your Wordpress website.

If you are using any AdSense plugin like Adinserter then you can also use that plugin to add the code in the footer section.

Just add the code in one of the boxes and set the placement to the footer.

Add anti adblock script in wordpress

So, in this way, you can detect Adblocker users on your Wordpress website and force them to unblock the adblocker tool.

Best Anti Adblock WordPress Plugins

If you don’t want to use a script then you can directly add an anti adblock plugin in Wordpress. Here, are the 5 best plugins you can consider.

  • Ad Blocker Notify
  • AdBlock X
  • Ad Blocking Detector
  • Simple Adblock Notice
  • Block AdBlock

Some of the plugins are not tested with the latest version of Wordpress and as the adblockers are evolving frequently, the plugin might not work in some cases.

So, these plugins also do the same job as that of the above plugin but the way of adblock notice is different and shows a different style warning message to the users. But, I recommend you to use the above script as it is more efficient and doesn’t require an additional plugin.

If you have any issues during this process, then you can ask me in the comment section.

Don’t forget to share this article with your Blogging community and help them earn more.

Similar Posts

Leave a Reply

Your email address will not be published.