How To Detect Adblock?

Can a website detect if the user is using Adblock?

  • Or other ad blocking extensions.

  • Answer:

    Yes, it is possible. It depends on how the ad is blocked, but two general principles that typically work are: Test if the ad content (typically an image) exist in DOM and has a height > 0. Test for a javascript object or function that should be present when the ad-script is loaded. Here are some more suggestions: http://stackoverflow.com/questions/4869154/how-to-detect-adblock-on-my-website

Alexander Sa at Quora Visit the source

Was this solution helpful to you?

Other answers

Yes, try visiting http://www.hulu.com/ with adblock enabled or read this post about Ars Technica's experiment with redirecting visitors who use AdBlock Plus.  They found it to be a 'disaster' though. http://arstechnica.com/business/news/2010/03/why-ad-blocking-is-devastating-to-the-sites-you-love.ars

Ian Withrow

You can find instructions for tracking the usage AdBlock from this web page: http://idahospuds.blogspot.com/2013/03/how-to-detect-block-ads-using-google.html

Anonymous

Yes it is possible, several off the chelf solutions exist including Clarity Ray, dSero, and D-Block as well as custom coded solutions. Each solution comes with its own advantages and limitations and it really depends on your budget and  the number of pageviews you have. Disclaimer: We just released D-Block.

Saad Kemmou

The general method is to create a bait (or fake ad) and check if it was blocked. For example you can create a script called "ads.js" and see if it is loaded properly. // Put this in the ads.js file isBlocked=false; And then use this code to detect ad blockers: <script>var isBlocked=true;</script> <script src="ads.js"></script> <script>if (isBlocked) {console.log("Ad blocking detected");} </script> Another way to detect ad blockers is creating a DOM object with a known ad tag, then check if the DOM was set invisible by the blockers later.

Tri Huynh

Yes,it is possible  to detect if the user is using Adblock.Signup now to http://www.adlatch.com/  for yourfree early-access toAdLatch dashboard. It’s a perfect solutionfor bloggers and publishers to engage and monetize Adblocker using visitors.All you have to do is put2 lines of AdLatch code on your blog or website andstart engaging with adblocker-using visitors in multiple ways to: Grow subscribersGenerate leadsStart acceptingpayments/donations from site visitors who are using ad blockersIncrease social sharing��Y����

Ved Prakash Yadav

I know this is kinda old, but now there's a better way to do it using a simple JS script called AdBlock Detector -> https://github.com/R4meau/abDetector) Here's how to use it:- Download/Clone the project, upload the file 'abDetector.min.js'  - Put this in your '<head>':    <script type="text/javascript" src="abDetector.min.js"></script>  - Use this wherever you want to display a message to AdBlock users:    <div id="ab-message" style="display: none">Your message here!</div>    You're done!

Anonymous

Javascript methods of detection are mostly client side code that can be manipulated. A friend of mine runs a startup in the US which is helping publishers fight the ad block menace. Its called Getpaywall. Viewers can read more about it on https://getpaywall.com/p/homeThey use server side code to detect the presence of ad-blocking on a website and is therefore more secure & robust.The idea is very simple, I am sure you guys must have seen what Forbes does. It intercepts all ad-blocking users and only allows them to access content when they whitelist http://forbes.com/. Getpaywall works in the same way. Once a publisher sets up getpaywall on his website, all ad-blocking users are given an option of either to disable the ad blocker (whitelist the publisher website) or to take up a premium paid subscription and continue browsing ad-free. Either ways, the publisher reaps the benefits.Getpaywall is currently in beta and we have been using it for one of our own websites for the past couple of weeks. It has helped us make significant improvements on CPC, CTR & RPM. Getpaywall has helped us reach out to more than 5000 ad-blocking users on our website in the past one week alone. (Our monthly traffic is close to 1 Million).Below is the snapshot of what ad-block users see on our website. Setting up Getpaywall on our website was fairly simple , no lines of code were required. It took us less than 2 mins to setup the whole thing.

Abi

This whole affair seems very destructive and is likely to lead to technological regression. Certainly you can use Javascript to detect ads, however if you disable Javascript you can disable the detector... which means people are probably going to begin disabling it again even as they did in the  malware era, but this time breaking a lot of websites which rely on Javascript driven technologies like CSS transitions and AJAX. And they will do it in enough numbers that they win, because website designs will devolve back to the inanimate designs of yesteryear in accomodation. Incidently, this will also put a stop to the privacy violations/data harvesting schemes made possible by Javascript. So by trying to burn down the stalls of the people who don't like ads, you're instead going to burn down the whole barn.

Anthony Caudill

A good way is described here http://broadstreetads.com/blog/detect-ad-blocker/ . The blog mentioned to use the following snippet. <div class="afs_ads">&nbsp;</div> <script> (function() {     var message = "We've detected that you have an ad blocker enabled! Please enable it and help support our work!";          // Define a function for showing the message.         // Set a timeout of 2 seconds to give adblocker         // a chance to do its thing         var tryMessage = function() {             setTimeout(function() {                 if(!document.getElementsByClassName) return;                 var ads = document.getElementsByClassName('afs_ads'),                     ad  = ads[ads.length - 1];                  if(!ad                     || ad.innerHTML.length == 0                     || ad.clientHeight === 0) {                     alert(message);                     //window.location.href = '[URL of the donate page. Remove the two slashes at the start of thsi line to enable.]';                 } else {                     ad.style.display = 'none';                 }              }, 2000);         }          /* Attach a listener for page load ... then show the message */         if(window.addEventListener) {             window.addEventListener('load', tryMessage, false);         } else {             window.attachEvent('onload', tryMessage); //IE         } })(); </script>

Ravi Mallya

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.