How to Display Alternate Content to AdBlock Users

ADblock now block your earning from your blog but your visitor trust on your blog may white-list you on adblock plus but for that you need to remember your visitor to unblock your blog from adblock. But there is only one sided job you can’t do anything if they do not white-list you.So what to do for notice your visitor to unblock your site :

I have solution of this you can notice your visitor by different way’s like by text, image,popup instead of this google ad code.You can also use in wordpress website.

Master code for replacing ad space with alternate content

  // Run after all the page elements have loaded
  window.onload = function(){ 
    // This will take care of asynchronous Google ads
    setTimeout(function() {     
      // We are targeting the first banner ad of AdSense
      var ad = document.querySelector("ins.adsbygoogle"); 
      // If the ad contains no innerHTML, ad blockers are at work
      if (ad && ad.innerHTML.replace(/\s/g, "").length == 0) {     
        // Since ad blocks hide ads using CSS too = 'display:block !important';         
        // You can put any text, image or even IFRAME tags here
        ad.innerHTML = '<img src="" width="300" height="250" />';      
    }, 2000); // The ad blocker check is performed 2 seconds after the page load 

 Display text instead of google ad:

Text display may see to your visitor or may not it will depends on your website theme design . Below given code use to show text notice to adblock user.

ad.innerHTML = 'Advertisement help us to pay out internet bill ! Please allow to our website to display ads ';

  Display image instead of google ad:

This will be perfect solution for notice visitor to unblock website in adblock. Image you can use any like gif animated image, flash image ,swf files etc.This image show where google ads code already placed.

ad.innerHTML = '<img src="" width="300" height="250" />';



One response to “How to Display Alternate Content to AdBlock Users”

  1. Its Work, but, only replace 1 my ads that was blocked
    not all my adss position

Leave a Reply

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