Forum Moderators: martinibuster
//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]);
}