How to check if AdBlock is enabled

By | January 8, 2015

Here is the simplest way to check if AdBlock is enabled on your site:

First of all you should create simple javascript file with following content:

var isAdsDisplayed = true;

Name it adsbygoogle.js and upload to your web server.

Then on the page where you want to check if AdBlock is enabled or not just add the following script:

<script src="/js/adsbygoogle.js"></script>
if(window.isAdsDisplayed === undefined ) {
  // AdBlock is enabled. Show message or track custom data here

You can use this method to show some message to users or track how many users are using AdBlock.

One thought on “How to check if AdBlock is enabled

  1. MundusLusus

    Hello and thank you for this clever trick. I really like it.

    I’ve inserted this on the footer.php on a WordPress installation. And I just want to give the user a message.

    However, instead of an alert(“some string”); I was trying to go for what I consider to be a more elegant solution, a modal pop up. I searched and I searched, and I tried and I tried, with plugins and manually, but I couldn’t do it. By any chance do you have an ideia on how to do it ?

    Thank you in advance


Leave a Reply

Your email address will not be published. Required fields are marked *