Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting AdBlocking software?

I was recently visiting a site and noticed that the page had a section that said it noticed that I was using AdBlocking software and could I kindly turn it off to help support a small site like that. I was just wondering how you would do that? Would it be best done client-side or server-side?

like image 539
James P. Wright Avatar asked Jul 26 '09 17:07

James P. Wright


People also ask

How do I check for Adblocking software?

The most definitive way is to look for AdBlock in the list of extensions installed in your browser: In Chrome or Opera, type about:extensions in the address bar.

How do websites know I have an ad blocker?

Some sites sniff out the software by downloading a small bit of JavaScript code meant to trigger an ad blocker, and then checking to see if the code actually made it through to the browser. Depending on your software, blocking advertisements may not have to be an all-or-nothing exercise.


2 Answers

This is something that simply can't be done server side - there's zilch reason for person to knock on your door and say "Look at me, I have AdblockPlus!". When on the client side, adblock is actively trying to influence the page content, which is something you can see happen and see that they are using an adblocker.

Anyway, I happened to know that newgrounds.com is doing this too. (their new layout was screwed up for adblock plus users - as a response they made a contest for the best "if you're not going to help us through our ads, go and buy something in the store"-banner.

A quick look in the source of newgrounds told me they are doing this with some simple javascript. First in the document:

var user_is_leecher = true;

Next there is a external script tag: src=checkabp?thisistotrickabp=***adress of ad affilliate***

Now the joke: they simply trust adblock plus to filter that script out, as all that's in there is: user_is_leecher = false;

From there, they can do just about anything.

like image 81
Jasper Avatar answered Oct 24 '22 21:10

Jasper


All off the methods mentioned here rely on the ad blockers to strip out code. This doesn't work for some adblockers(like NetBarrier on Mac). You also have to keep updating your code when the adblockers catch on.

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, do something else.
}

This method is outlined here: http://www.metamorphosite.com/detect-web-popup-blocker-software-adblock-spam

like image 25
Beau Avatar answered Oct 24 '22 22:10

Beau