• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Jaxel's Implementation of Ad Block Detection

Jaxel's Implementation of Ad Block Detection

Jaxel

Well-known member
#1
Jaxel submitted a new resource:

Jaxel's Implementation of Ad Block Detection - How to detect if a user is using ad-block and warn them...

So many of you have already noticed the new ad-block notice I'm using on my website at http://8wayrun.com/. Since implementing this new notice, I've received a lot of PMs from people asking me how I did it. Well I can't take credit for it, as I got the ideas from ThePCSpy. So what I'll do here is tell you guys how I implemented it on my website.

Firstly, as explained on ThePCSpy, detecting ad-block is actually very easy....
Read more about this resource...
 

HWS

Well-known member
#4
We do the same at our site (however with a slightly different code) and implemented a counter to see how many % of our users use ad blockers. It is app. 30% who use that.

We now change the code to allow guests with ad blockers to see only 5 pages before they are forced to switch off the ad blocker or register.
 

Stuart Wright

Well-known member
#6
Interested to hear what value you put on paid membership to turn ads off. Some people on our forum were saying they'd happily pay £5 a year to switch off ads. Yeah, right.
And the problem I have with paid membership is that they will complain to the CC company/Paypal if we then ban them for any reason.
The adblock people told me that they would not try to circumvent our adblock detection if we only used it to present a polite request to turn ads off. Otherwise they work to defeat you. And we limit access to some features to people who adblock.
The problem with publishing this solution it is that the more people who use it, the more the adblock people will see it and be motivated to work a way round it.
 

akia

Well-known member
#7
Interested to hear what value you put on paid membership to turn ads off. Some people on our forum were saying they'd happily pay £5 a year to switch off ads. Yeah, right.
And the problem I have with paid membership is that they will complain to the CC company/Paypal if we then ban them for any reason.
The adblock people told me that they would not try to circumvent our adblock detection if we only used it to present a polite request to turn ads off. Otherwise they work to defeat you. And we limit access to some features to people who adblock.
The problem with publishing this solution it is that the more people who use it, the more the adblock people will see it and be motivated to work a way round it.
Not if everyone changes it a little, if its a copy paste job then there will be a footprint but if you change the class names and text etc then it would be difficult to block.
 

Jaxel

Well-known member
#8
Not if everyone changes it a little, if its a copy paste job then there will be a footprint but if you change the class names and text etc then it would be difficult to block.
Exactly. In fact, the class names I posted in the guide are not the class names I use on my site.
 

thumped

Well-known member
#10
seeing something similar; looks like the JS always returns 0 from my ad code- I'm using an agencies adtech.de invocation code, not adsense though.
 
Last edited:

akia

Well-known member
#12
@Jaxel whats been the response rate with this. Have you had more people sign up for premium membership. Is it actually worth doing?
 

Jaxel

Well-known member
#13
@Jaxel whats been the response rate with this. Have you had more people sign up for premium membership. Is it actually worth doing?
I'll tell you in a week after my advert numbers come up. I don't expect more premium memberships, just more adserves.

The problem is my community is actually pretty technically savy; and I have EXTREMELY high rates of adblock. As well, lots of people also use things like Firebug and I wouldn't be surprised if many of them create custom CSS rules to hide the adblock notice container. I know many of them use custom CSS rules to make the website black.
 

JordanH

Well-known member
#14
I'll tell you in a week after my advert numbers come up. I don't expect more premium memberships, just more adserves.

The problem is my community is actually pretty technically savy; and I have EXTREMELY high rates of adblock. As well, lots of people also use things like Firebug and I wouldn't be surprised if many of them create custom CSS rules to hide the adblock notice container. I know many of them use custom CSS rules to make the website black.
Great you answered him. Care to answer the other two?
 

Mike Fara

Active member
#15
If Jaxel's mod doesn't work you can always destroy adblockers with fire using some crazy code out there. The problem is that people who use ad block would normally never use the site if they were not allowed to use ad block... well at least thats their argument. I almost had a mutiny on my hands when I introduced similar programming, except mine locked the screen and demanded you turn it off.. lol. Well, I suppose people just don't understand this stuff doesn't run itself for free.
 

Jaxel

Well-known member
#16
If Jaxel's mod doesn't work you can always destroy adblockers with fire using some crazy code out there. The problem is that people who use ad block would normally never use the site if they were not allowed to use ad block... well at least thats their argument. I almost had a mutiny on my hands when I introduced similar programming, except mine locked the screen and demanded you turn it off.. lol. Well, I suppose people just don't understand this stuff doesn't run itself for free.
Thats because what you are doing is bad.

With the adblock detection I use here, I am not hindering a user's experience with my website. Its just a big notification that they must overlook. The purpose of the notice isn't to stop or hinder the user, its to make them feel like a ****ty person. If you ruin the experience for the end user, they will just work to stop you.
 

Mike Fara

Active member
#17
I think that is a fair trade off. Question @Jaxel are you familiar with the embedded

Code:
<style>#za43{position:fixed!important;position:absolute;top:0;top:expression((t=document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop)+"px");left:0;width:100%;height:100%;background-color:#fff;opacity:0.9;filter:alpha(opacity=90);display:block}#za43 p{opacity:1;filter:none;font:bold 16px Verdana,Arial,sans-serif;text-align:center;margin:20% 0}#za43 p a,#za43 p i{font-size:12px}#za43 ~ *{display:none}</style><noscript><span id=za43><p>Please enable JavaScript!<br>Bitte aktiviere JavaScript!<br>S'il vous pla&icirc;t activer JavaScript!<br>Por favor,activa el JavaScript!<br><a href="http://antiblock.org/">antiblock.org</a></p></span></noscript><script>(function(w,u){var d=w.document,z=typeof u;function za43(){function c(c,i){var e=d.createElement('span'),b=d.body,s=b.style,l=b.childNodes.length;if(typeof i!=z){e.setAttribute('id',i);s.margin=s.padding=0;s.height='100%';l=Math.floor(Math.random()*l)+1}e.innerHTML=c;b.insertBefore(e,b.childNodes[l-1])}function g(i,t){return !t?d.getElementById(i):d.getElementsByTagName(t)};function f(v){if(!g('za43')){c('<p>Please disable your ad blocker!<br>Bitte deaktiviere Deinen Werbeblocker!<br>Veuillez d&eacute;sactiver votre bloqueur de publicit&eacute;!<br>Por favor, desactive el bloqueador de anuncios!<br><a href="http://antiblock.org/?d=2.3'+'___'+escape(v)+'">antiblock.org</a> <i>v2.3</i></p>','za43')}};(function(){var a=['adsense'],l=a.length,i,s='',e;for(i=0;i<l;i++){if(!g(a[i])){s+='<a id="'+a[i]+'"></a>'}}c(s);l=a.length;setTimeout(function(){for(i=0;i<l;i++){e=g(a[i]);if(e.offsetParent==null||(w.getComputedStyle?d.defaultView.getComputedStyle(e,null).getPropertyValue('display'):e.currentStyle.display)=='none'){return f('#'+a[i])}}},250)}());(function(){var o={'http://pagead2.googlesyndication.com/pagead/show_ads.js':'google_ad_client'},S=g(0,'script'),l=S.length-1,n,r,i,v,s;d.write=null;for(i=l;i>=0;--i){s=S[i];if(typeof o[s.src]!=z){n=d.createElement('script');n.type='text/javascript';n.src=s.src;v=o[s.src];w[v]=u;r=S[0];n.onload=n.onreadystatechange=function(){if(typeof w[v]==z&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){n.onload=n.onreadystatechange=null;r.parentNode.removeChild(n);w[v]=null}};r.parentNode.insertBefore(n,r);setTimeout(function(){if(w[v]===u){f(n.src)}},2000);break}}}())}if(d.addEventListener){w.addEventListener('load',za43,false)}else{w.attachEvent('onload',za43)}})(window);</script>
I ask because when I go to your site I still see ads and no notice with Adblock in Chrome. So perhaps you have found a way to simply render the ads without the notice? That is the crazy code I was experimenting with by the way. It does work from antiblock.org but it is quite stringent.
 
#18
Thats because what you are doing is bad.

With the adblock detection I use here, I am not hindering a user's experience with my website. Its just a big notification that they must overlook. The purpose of the notice isn't to stop or hinder the user, its to make them feel like a ****ty person. If you ruin the experience for the end user, they will just work to stop you.
Agreed, if someone doesn't want to view ads and is bent on that, shoving the ads down their throat forcibly wont work.
 

Liam W

Well-known member
#19
Anyhow, this is easily circumvented by just using the adblock addon to block the div with the adblock notice, which most people with adblock will probably do...

Anyhow, good piece of code, thanks for sharing :)
 

Jaxel

Well-known member
#20
So I saw on an XF nulled website (I occasionally do vanity searches on Google to see who is pirating my software), that a user is claiming using this code got his website banned from Google Adsense. Does anyone know if using such a code violates Adsense terms and conditions?

As far as I know, it is only against terms to request users to CLICK on ads, not to disable ad-blockers.