Marathia’s Stacks

stacks for the rest of us

stacks for the rest of us

Stacks Image 91039

AdblockDetector Stack

take action when an ad blocker is detected

For those of you rely on ads to finance their site (or even more than just their site), ad blockers can be a pain in the back. No ads, no clicks, no money, right?

With this stack, you can detect if a visitor has an ad blocker installed. If so, you can take one of the several possible actions the AdBlockDetector Stack offers: ask them if they would like make an exception for your site, explain why how to do that (in different ways) or even redirect people to another page (although that may be a little too aggressive in most cases).

Demos
Due to the nature of this stack, you will only see what this stack does on the demo pages when you have an ad blocker installed.
This stack offers five kinds of actions:
show content of this stack (demo #1)
Shows a custom message on the page
show a generic alert (demo #2)
A browser generated alert will be shown.
show a LightboxMe lightbox (demo #3)
Shows a lightbox with a message using the LightboxMe Stack.
simulate a link click (unsupported bonus feature*)
This option is meant for triggering a third party lightbox.
redirect to another page (demo #4)
This is by far the most aggressive method. The visitor is denied access to the content of the page as long as they don’t disable their ad blocker for your site.
* This option will not work with every lightbox. It is know to work with Joe Workman’s Reveal Lightbox, but not with Big White Duck’s Limelight. It may work with others too, but your mileage may vary. I have no other third party lightbox stacks, but if you do I’d love to hear from you if it works (or not).

Usage
With the option show content of this stack selected, a dropzone is shown in the AdblockDetector Stack. Drag any content into this dropzone (text, images…) and it will show on the location of the Stack.
If you don’t like the standard alert, you can use the option show a LightboxMe lightbox to show a message in a lightbox using the LightboxMe Stack. Just make sure the target id of the AdblockDetector Stack (fig. 1) is identical to the unique id in the LightboxMe Stack; and the option behaviour in the LightboxMe Stack is set to open this lightbox when clicking a link (fig. 2).
The LightboxMe Stack is sold separately. More information on the product page.
With the option redirect to another page you can set the link to the page you want to redirect your visitor to. The option Open in New Window in the redirect link window (or rel="external" or target="_blank") will not work. Most browsers would block the popup anyway…
With the option show a generic alert selected, a browser generated alert will be shown.
In the alert text, precede single quotes with a backslash: don\'t. For a line break, type \n.
The option simulate a link click is meant for triggering a third party lightbox. Set the link attributes as you would with a ‘normal’ link that will open the lightbox.
This unsupported bonus feature will not work with every lightbox. Don’t ask me to fix it if it doesn’t work with lightbox stacks made by others.
With the option show in Preview mode enabled, the action selected will always be triggered (with or without an ad blocker present), but only in Preview mode or when previewing the page in a browser (so not when the page is published). The generic alert however cannot be shown in RapidWeaver Preview mode. Preview the page in a browser to see it.
NB
There is some discussion in some countries if it is legal for a webmaster to determine if their users have an adblocker installed or not (read more). I have no idea what to think of this, because many respectable sites all over the world use it. And just to be clear: this stack does not use cookies. Anyway, use this stack at your own risk!

Limitations
When the visitor has JavaScript disabled in his browser, no action will be triggered.

Background
This stack is inspired by (and based on) the clever work of JonathanMH. It will work with any ad blocker (Adblock, Adblock Plus, uBlock…).

Support
Please use this form to report all issues, questions and comments.

This stack requires RapidWeaver (version 7 or higher) and the Stacks plugin by YourHead (version 3.5 or higher).
Do you like this stack? Please consider leaving a review in the RapidWeaver Community’s Addons section [link].

Yes, this website uses cookies too. Here’s the annoying but obligatory cookie warning. More info…