0
Displaying the Alternate Content to AdBlock Users where AdBlock and Ghostery are installed on millions of computers 

AdBlock and Ghostery are the software's installed on millions of computers and these are affecting the bottom line of web publishers who depends on online advertising networks like Google AdSense to pay their bills. It takes time and effort to maintain a website but the revenues are reduced if the visitors are blocking the ads, Ars Technica says this is equivalent to running a restaurant where people come and eat but without paying the bill.

As a publisher of website you have a some options. That You can remove the Adblock option on the visitor’s computer and can hide the content if the ads are being blocked. That is going too far but you may ask for donations/ request social payments from AdBlock users.

The other option is you can display the alternative content to the people who are blocking the ads. For example you may display a Facebook Like box/ Twitter widget in the place of ads you may run in-house ads promoting articles from your own website which are similar to Google DFP or you can display any other custom message to the visitor.

Before the implementation details, once look at the demo page. It contains regular AdSense ads but if you are using an Ad blocking software, the Facebook Like box will be displayed inside the vacant ad space.

                                                    Anti Ad-block Demo

It easy to build a solution for your website. firstly Open your web page that contains Google AdSense ads and copy-paste the following snippet before the closing </body> tag. The script looks for the first AdSense ad unit on the page if it is not found an alternative HTML message is displayed in the available ad space.


You can also keep a Facebook Like box, YouTube video, Twitter widget/ an image banner/ site search box/ even plain text.

<script>

  // 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
        ad.style.cssText = 'display:block !important';
     
        // You can put any text, image or even IFRAME tags here
        ad.innerHTML = 'Your custom HTML messages goes here';
   
     }
   
    }, 2000); // The ad blocker check is performed 2 seconds after the page load
  };

</script>

The above snippet only detects the blocking of AdSense ads and replaces them with alternate content. The process is different for BuySellAds or other advertising networks.

Post a Comment

 
Top