Asking nicely is the only option you have
You do not really have the power to selectively deny service to users who did not view ads. There's no reliable way to determine which users were shown ads and which weren't.
The client is not under your control. After the browser downloads the page, the content is in the user's computer. Once out of the server, you cannot really block it anymore. What happens then is determined by how much the user will let you get away with.
I've written code to combat the ad blocking by either circumventing it, or if that fails, disabling the page until the user disables the ad blocker
And then users respond by writing code that disables your counter measures. By trying to block users, you enter a technological arms race with people who develop software whose entire purpose is to defeat you, people who will gladly take you up on your challenge.
Actively circumventing a user's ad blocker is disrespectful to the user at best and puts your site in the same class as malware at worst. People do not install ad blockers by accident.
- For users who block ads, your website will not be usable at all.
- You made it so. Deliberately.
- In an attempt to coerce them into viewing ads they didn't want to view.
- People with the know-how will easily defeat whatever schemes you employ.
- You'll just make users install a better ad blocker.
An analogy with TV advertising
Can you force consumers to sit down and watch TV ads? Not really. You can't prevent them from leaving the room. You can't stop them from changing the channel or muting the TV. They can record the programming and skip over all the ads when they watch it. There are devices which automatically remove ads from recorded footage.
You can't really detect or block any of this. The only real way is to not put it in the air in the first place. You can scramble the signal, but that just means only people with the means to unscramble the signal will get to watch it; it does not mean only people you have approved will watch it.
Imagine that the TV companies somehow introduced a TV control mechanism into their signal, so that during advertisements they'd be able to turn up the TV's volume all the way up and completely disable the user's remote control. Ingenious, right? Now they'll be forced to listen even if they leave and they can't change the channel or mute the TV either.
How do you think users would feel about that? The more control you try to grab, the more unacceptable it becomes.
Such a scheme would also require TVs that actually executed the commands coming from the TV companies. If anyone actually made such TVs, the market would react by creating models that had no TV company control as a feature, instantly defeating the whole thing.
That is the exact situation with ad-supported web sites today. Your anti-ad blocking software won't work if the client refuses to execute it, and no self-respecting web browser will allow you to take that control away from the user.
Lessons from the video games industry
Since its birth, developers have been trying and failing to limit what users can do with their games. They invested absurd amounts of money into copy protection schemes and yet pretty much every measure they devised was defeated, more often than not within days.
Ironically, pirates release what is arguably a superior version of the game. The genuine game comes encumbered with software that essentially treats the customer like a criminal who has to prove he's innocent. The pirate version has none of that.
When you break your own site just because some user didn't want look at ads, the ad blocker will save the day. By defeating you, the ad blocker restores usability. Is this how you want users to feel towards your site?
What would Google do?
According to an 2016 interview with Google's Senior VP, Ads and Commerce Sridhar Ramaswamy, the answer is to figure out how to make better ads.
What are you seeing in terms of trends among Google's audience when it comes to ad blocking?
[...] we think this is actually a great time for the industry to be talking together and figuring out what are better ad standards.
The fact of the matter is that when you want to read a short article
on something and you click on a link, you're not expecting to have an
ad that completely covers the screen [and] have to hunt around for the
I think there are a number of experiences that are not great, so I
think we need to come up with a better ad standard.
What specifically is Google doing?
[...] we're working on figuring out what are standards we can all agree with in terms of this better ads experience. Aspects include
latency, how many requests are fired and what kind of experiences are
OK and not OK and so on.
Make better ads so that users won't want to block them. The idea of blocking the user's blocker isn't even discussed.
Play nice with the user, and they will play nice with you. So, ask nicely!
AdBlock Plus introduced the notion of acceptable ads. In order to support websites that run unobtrusive ads, it can be configured to automatically whitelist such ads.
This article from Adobe, contributed by Devin, is another example of this perspective.
Ad blocking is a form of user feedback
Users are fed up with bad advertising experiences. Every install of an
ad blocker is a statement against annoying ads, security risks, slow
browsing, and ads’ consumption of computing resources. With ad
blockers, users have taken back control of their browsing experience.
Now, it’s up to publishers to adjust.