0

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">&nbsp;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..

1 Answer 1

3
window.onload=_abpde(); 

should be

window.onload=_abpde; 

() makes the function execute immediately.

Sign up to request clarification or add additional context in comments.

1 Comment

Ah thank you mate! That did solve a few problems, it still doesn't count users as it should though but that is another problem :P

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.