Reputation: 65
I am trying to show which users have AdBlock and pass this information to Piwik but it seems to fail. It just shows like everyone got AdBlock enabled..
Here is the code I am using:
function _abpde() {
if (document.getElementById("AdDiv")==null || document.getElementById("AdDiv").offsetHeight<=0) {
_paq.push(['setCustomVariable',1,"AdBlock","Enabled","page"]);
} else {
_paq.push(['setCustomVariable',1,"AdBlock","Disabled","page"]);
}
}
window.onload=_abpde();
And I am ussing the div:
<div class="AdDiv" id="AdDiv"> asd</div>
Any ideas what I am doing wrong? Thanks!
PS: When I try to remove the document.getElementById("AdDiv")==null
the whole script fails and it doesn't even count visits..
Upvotes: 0
Views: 76
Reputation: 160883
window.onload=_abpde();
should be
window.onload=_abpde;
()
makes the function execute immediately.
Upvotes: 3