4 ms·
What is the best way to detect if a user has enabled uBlock or Adblock? I wanted to do it for a project I'm working on, but many solutions fail.
by kingstoned 3y ago
What is the best way to detect if a user has enabled uBlock or Adblock? I wanted to do it for a project I'm working on, but many solutions fail.
- jacquesm 3y agoGood.
- inetknght 3y ago> What is the best way to detect if a user has enabled uBlock or Adblock? 1. Don't. 2. If the user blocks your advertisements, then the user doesn't want them. You should respect the user's desires. 3. If the user blocks your scripts, then the user doesn't want them. You should respect the user's desires. 4. If your site breaks because of things, then your site sucks. You should build your site to fail gracefully.
- joshmanders 3y agoOn the flip side: It's their site, they pay for the resources, provide the work, if they want to block people who block their ads, they have that right. You are not entitled to my website because I put it up.
- inetknght 3y ago> It's their site, they pay for the resources, provide the work, if they want to block people who block their ads, they have that right. > You are not entitled to my website because I put it up. Yup, I absolutely agree. But if you want people to pay for your site, then you must force users to log in to use your content. If you put your site up without a login portal then your site is free. Advertisements sent to anonymous users are not a valid option: they are easily gamed, easily abused, and easily contain malicious content. If you want to serve advertisements, that's your business, but do it to users who have clearly opted into it. If users don't want that then they won't sign up to your site. It's a win-win on both sides.
- kingstoned 3y agoI'm not trying to block people who use adblockers or make experience worse. There are other reasons why someone might want to know if some portion of users are using adblockers. I personally use uBlock. Do you know a reliable way to do it?
- carlosjobim 3y agoA paywall works. Or rolling your own ads together with partners wanting to sell stuff.
- chii 3y agoit's a heuristic based approach, but essentially, you ensure that your ad-script would set some sort of global variable, or a property somewhere, and your detection script would look for that property. If it's not set, you have a good probability that the ad was blocked. Of course, this doesn't detect element hiding. To do so, you'd need to setup a bunch of mutation observers https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver https://developer.mozilla.org/en-US/docs/Web/API/MutationObs... , and detect that your ad's container or div/image was removed. It's a bit annoying, but doable. Lastly, you could try to detect the adblocking scripts as well.
- alexb_ 3y agoDon't use ad services that collect user data and serve personalized ads. Find someone who actually wants to advertise THEIR AD on YOUR SITE, and present it as regular content. If you are trying to subvert people's ad block, you are doing it wrong.
- kingstoned 3y agoI don't serve ads on a website and I'm not blocking users who use adblockers. I'm trying to find a reliable way to detect usage of adblockers for legitimate analysis. Do you know a way to do it?
- juliangoldsmith 3y agoBy their nature, adblockers need to be undetectable by websites. If you're just looking for statistics, why not go for a survey? It'd be more reliable than trying to detect something designed to avoid detection.