-3

I just want to find out, how many of my website users are using adblock (plus/pro/whatever). For this, I have implemented the following:

  • I track a visit of my HTML document (actually I track every request, but only the first one is a "visit". I use a session to check, if its the first visit) and save it to db
  • I have included a javscript file with the name /ad_server/banner/ad.js which is a php script which also tracks the visits and save it to db

In theory this should mean for example: 100 html_visits and 90 js_visits would mean, that there were 10 Users which requested the html file, but not the js file (which was blocked by AdBlock)

My problem now is, that I get 75.2% of users with an adblock, which is compared to different studies (25-30%) for my country a too large number. My website isn't tech specific, so the percentage shouldn't be that high.

Where is the error in my concept?

I append a timestamp to the js file url (/ad_server/banner/ad.js?1435143401) and disabled cache for that file (Cache-Control: no-store, no-cache, must-revalidate, max-age=0"; Pragma: 'no-cache') to prevent cache issues.

bernhardh
  • 3,137
  • 10
  • 42
  • 77
  • It's not clear for what purpose you need that detection so it would be great if you could clarify that. Keep in mind that you're not detecting an adblocker. You're checking whether a request didn't reach the server which can have multiple different causes. It's comparable to doing browser detection via user agent which is discouraged. The recommended approach for that would be feature detection. – greiner Oct 02 '15 at 15:48
  • Basically, I need this information for choosing the right source of income. If there are 90% of adblock users, I can't rely on banner ads and have to find other source. If only 20% of my users have an adblock, I can rely on ads. I know that my concept isn't perfect, but I have no idea how I could find it out in another way. – bernhardh Oct 02 '15 at 21:35
  • There is no reliable way to check whether an ad would be blocked other than implementing the ad and then looking at the results (i.e. impressions, clicks, request errors, etc.). Any other method (e.g. checking whether a "similar" request returns an error) is not guaranteed to produce somehow comparable results due to constantly changing blocking rules and the high variety of content blocking software and techniques. – greiner Oct 03 '15 at 14:19

1 Answers1

1

Seems like using a file named ad.js would itself be blocked by Adblockers. Since I can't see your code, I can't tell you if your logic is flawed or anything.

I wrote something like this the other day.

<html>
  <head>
    <script src="adcity.js"></script>
  </head>
  <body>
    <script>
      if( window.adblockerCheck === undefined ){
          // adblocker blocked our fake adcity.js file
          // send event to GA or other analytics provider
      }
    </script>
  </body>
</html>

And then all that adcity.js file has in it is:

window.adblockerCheck = true;

This is the simple version. At work I ended up doing a jquery $.ajax('adcity.js') and checking the status and stuff in the .complete() callback. That way we can check for different reasons that the request may ahve failed like 'timeout', etc.

Cory Harter
  • 124
  • 8
  • Maybe my question was not clear enough. The file ad.js SHOULD BE blocked! Thats how it should work. I want to find out, how often the ads.js is requested (or blocked) compared to how often the html is requested. Basically: If HTML and JS is requested means, that there is no adblock; If Html is requested, but not JS, then there is in most cases an adblock active. I know, that there are some other problems, why the js is not requested (caching, etc.), but I want to reduce this problems! – bernhardh Oct 03 '15 at 07:18
  • Just log an event with GA or whatever when the page loads indicating a normal 'pageview' event. Then, separate from that, log a different event for when the call for ad.js file is unsuccessful. Unsuccessful / pageviews = adblock percentage – Cory Harter Oct 03 '15 at 17:04