Forum Moderators: martinibuster

Message Too Old, No Replies

Adsense blocker doesn't always trigger noscript. Solutions?

         

Sgt_Kickaxe

12:10 am on Apr 2, 2012 (gmt 0)



I'm seeing multiple ad blockers targeting adsense by default and the noscript tag I have added doesn't trigger an alternate ad, apparently because the user has javascript turned on still. Given that several of these blockers are available as browser addons, some having more than a million downloads, I was wondering if there was a solution to this problem.

How can I best show a replacement ad to someone who specifically blocks adsense(without removing adsense of course)?

levo

2:06 am on Apr 2, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You can either check the height of the iframe that adsense creates, or you can use an external js file with a sure-to-be-blocked filename and check a cookie on consequent requests...

levo

3:14 am on Apr 16, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Just implemented a code; if you have an adsense unit in a div with an id of "addiv"




//prepare cookie date - 1 day
var expires = new Date(new Date().getTime() + 86400000);
expires = expires.toUTCString();

//check the height of the iframe that adsense code creates
if ($('#addiv').find("iframe").height()>10) {
//ads not blocked - set a cookie
document.cookie='adcheckcookie=allowed; expires='+expires+'; path=/; domain=www.domain.com';
//optional - track with non-interaction event
_gaq.push(['_trackEvent', 'Detect AdBlock', 'Allowed', document.title,0,true]);
} else {
//ads blocked
document.cookie='adcheckcookie=blocked; expires='+expires+'; path=/; domain=www.domain.com';
//optional - track with non-interaction event
_gaq.push(['_trackEvent', 'Detect AdBlock', 'Blocked', document.title,0,true]);
}