How to block AdBlock users without JavaScript

This is probably one of the most rotten experiments I have done in recent
times. I wanted to see what would happen if I blocked site usage from folks
using ad blocking software. Would it cause a stir? Would people figure out that
their ad blocker is to blame? Would it upset the site’s ecosystem?

The answer to all of those questions is “YES” and I honestly don’t recommend
doing this to your users. In fact, I don’t even recommend slapping ads on your
site. Find a better way to build a business, ad revenue is just too damn
volatile, even if you are doing direct sales.

Anyway, ranting about how your customers become the product when ads are
involved and all of that soapboxing nonsense isn’t the point of this post. The
point is to discuss how fucking it easy it is to trick ad blocking software
into denying people access to your site.

So to start off, I did some research on how to write filters for AdBlock
Plus
. Once I had the gist of it, I went ahead and got my hands on a
list of filters. This is easily done by going to the options for the extension
and clicking on the name of the filter list. I went with EasyList because it
was there and I guess it’s enabled by default.

Upon vising the EasyList website and snagged a copy of the filters.
It’s a pretty massive file, but I knew what I was looking for. If you search
the file for ##. you’ll see some class names that are considered ads and
should be blocked.

I took one of those values, like ##.TTButtAd (because butts) and slapped the
class name on the body: <body class="TTButtAd">. Cue explosions, because the
site was being recognized as an ad and the whole body was being hidden.

As I mentioned, I don’t recommend this at all because it doesn’t provide your
users with any explanation as to why the site is borked. It was a fun
experiment though, so maybe you do want to give this a shot. Hell, maybe you
could be really devious and add one of those blocked classes to buttons or
something like that, so many ways to troll.

Even though I am not recommending you do this, there is still a lesson to be
learned. First, don’t always throw JavaScript at your problems, understand the
system you are working with and figure out how to make it do the work for you.

Second, you could pair this technique up with some JavaScript to figure out if
a user is rockin’ an ad blocker and then harass them. Interrogating the ad
units on your site directly may not be an option if you are doing some
responsive voodoo to show and hide the ad units based on screen size (which is
actually allowed by AdSense now 😉

I leave you with one of the nicer quotes from this experience:

Whatever if sk did actually block adblock then good on them, ads are the only
cash flow this website has lol, they need the money. I support this. Good on
you.

Josh Sherman - The Man, The Myth, The Avatar

About Josh

Husband. Father. Pug dad. Musician. Founder of Holiday API, Head of Engineering and Emoji Specialist at Mailshake, and author of the best damn Lorem Ipsum Library for PHP.


If you found this article helpful, please consider buying me a coffee.