Help Center Ad Tools

Ad Blocker Detection

Ad blockers, like AdBlock or AdBlockPlus, are a problem with publishers that depend on advertising. They work with a block list of URLs and patterns and you can learn more about ad blocking here. To detect ad blocking, you can implement a check to determine ad block status and handle users who block advertising on your site accordingly with this code on your page:
<script src="//g.adspeed.net/ad.php?do=detectadblocker" type="text/javascript"></script>
<script type="text/javascript">
  window.addEventListener('load', function () {
    if (document.getElementById('My-AdServer')) { 
      alert('Good! Ads NOT Blocked'); 

      // Records in Google Analytics (choose one method: ga or gtag)
      // ga('send','event','Ads Blocked?','No',{'nonInteraction':true});
      // gtag('event','Ads Blocked?',{'event_label':'No','event_category':'Advertising','non_interaction':true});

    } else { 
      alert('Bad! Ads BLOCKED'); 

      // Records in Google Analytics (choose one method: ga or gtag)
      // ga('send','event','Ads Blocked?','Yes',{'nonInteraction':true});
      // gtag('event','Ads Blocked?',{'event_label':'Yes','event_category':'Advertising','non_interaction':true});

      // do something since this viewer is not seeing ads on your site
      // eg: if you want to redirect to your advertising/ad-supported notice page
      // window.location = "https://example.com/?NoticeAdvertising";
    }
  });
</script>
You should change the default behavior, which opens a message dialog, to a suitable action. You can show a message, redirect to a notice/entrant page or log the response into your web analytics software (eg: Google Analytics) to find out how big of an impact from ad blockers on your site and advertising revenue.

Other Articles in Ad Tools

Tools that can help ad operations, ad serving, and ad management tasks easier and quicker

Cannot find an answer for your question? Ask our Customer Care team

Related