I want to be able to detect if the user is using adblock plus or any blocking ad extension. How can I do this in Drupal ?

Why ? I'm building a website that is going to contain ads on a block (so far I do not think I would use the adsense module) that block would only be display it to anonymous users. If the user have adblock plus enable on their browser, I would like to show another block that said something similar to this "If you enjoy our content free to ads you should become a member of this site. Ads help us creating more content." I would set a link on that block to encourage user to buy a role to help that website.

So far I notice there is a very popular question at Stackoverflow "How to detect Adblock on my website?". But I was wondering if there is a module or better Drupal way to detect if the user is using adblock plus.

  • Have you had a look at the dSero module ?
    – rtome
    Commented Apr 15, 2015 at 5:42

1 Answer 1


As of right now, there are no ad blocking modules on drupal.org, save for the dSero module, which is more of a proxy for the dSero service, thus, not really a solution for detecting adblock usage.

AdBlock detection is simple in practice; include markup regions (e.g. a div & image sized to a standard 728x90 leaderboard ad size) and/or execute JavaScript (e.g. running JS called ad.js) that triggers the AdBlocker to hide it, then having some other isolated code check if region was hidden or the JS code was executed.

With that known, any Drupal based solutions are going to involve either finding an existing front-end library (e.g. FuckAdBlock) or creating your own. Given that any popular solution is ultimately self-defeating (e.g. the AdBlock updating its code to check for common Anti-AdBlocking tactics/libraries), you're probably better off creating your own custom front-end solution that catches ad blocking.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.