How To Detect Adblock?

How to detect Adblock on my website?

  • I would like to be able to detect if the user is using adblocking software when they visit my website. If they are using it, I want to display a message asking them to turn it off in order to support the project, like http://www.playonlinux.com/en/ does. If you enter to that site and your browser has some kind of adblock software enabled, then the site instead of showing the actual ads shows a little banner telling the users that the ad revenue is used for hosting the project and they should consider turning Adblock off. I want to do that on my website, I'm using adsense ads on it, How can I do that?

  • Answer:

    http://thepcspy.com/read/how_to_block_adblock/ With jQuery: function blockAdblockUser() { if ($('.myTestAd').height() == 0) { window.location = 'http://example.com/AdblockNotice.html'; } } $(document).ready(function(){ blockAdblockUser(); }); Of course, you would need to have a landing page for AdblockNotice.html, and the .myTestAd class needs to reflect your actual ad containers. But this should work.

Jmlevick at Stack Overflow Visit the source

Was this solution helpful to you?

Other answers

Not a direct answer, but I'd put the message behind the ad to be loaded... rather that trying to detect it, it'd just show up when the ad doesn't.

mavrck

That website probably doesn't directly detect adblockers. Thee appears to be a layer behind the ad, which is in the HTML whether the adblocker is loaded or not. The trick is, it's only visible if there's no ad in front to cover it up.

Matthias Wandel

To detect if the user is blocking ads, all you have to do is find a function in the ad javascript and try testing for it. It doesn't matter what method they're using to block the ad. Here's what it looks like for Google Adsense ads: if(typeof(window.google_render_ad)=="undefined") { //They're blocking ads, display your banner } This method is outlined here: http://www.metamorphosite.com/detect-web-popup-blocker-software-adblock-spam

Beau

Related Q & A:

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.