Back
Question
Asked

What is the best service / snippet to detect ad blockers?

Hey, 

All my websites are free and ad-driven. I wonder if anyone has experience with ad-blockers and how to detect them?


Do you think a significant amount of your traffic is using blockers? Do you intend to block them or put more of a friendly "if you find this useful please disable blockers"?

Wow...didn't even think that far...

Hmm, I guess I'd like to block them. So remove the ad-blocker, and all good. Because these are all free, no taking your email, no force you to sign up.

In my experience, it's a game of cat and mouse. The ad blockers are always adapting to new services and snippets. It's best to code it yourself.

It can be as simple as creating a div that blocks your content, then creating a ads.js files that removes the div. Or making your content hidden with CSS and the ads.js file makes it visible

Sorry, not following the description here, but my research seems to agree with you regarding writing it myself.

Do you have any code examples you could share, it might help me understand what you explained above.

Sorry, it's been forever since I last did it and can't find my code example.

The gist of it is that the ad blocker will block the ads.js file. So the code in that file will not run.

Another approach is to check the .offsetHeight property of your ad element onload. If it's 0, then that means the ad blocker set its css display to "none".