3 Ways to Use jQuery to Detect AdBlock

Ad blocking software is becoming increasingly prevalent among internet users, for a number of reasons. The most important of which is that, often times, ads can really decrease a user's experience. They can be obnoxious, and they can be slow -- and not just slow down your webpage, but also a user's entire browser or computer. Additionally, ad blocking software is now super easy for even the least technologically savvy users to get ahold of -- the Chrome extension for AdBlock makes it particularly easy to install.

For many casual web page browsers and internet users, this ad blocking software is great news. For website owners and operators, however, it's brutal. Because many websites rely on revenue from ads to keep running, ad blocking software can severely decrease the amount of money they're able to make from their website. With jQuery, it's actually possible to detect if a user is taking advantage of ad blocker software. Once the ad blocker is detected, you can choose to ask them to whitelist your site or even take it so far as to block them from your site until they've removed their ad blocker or whitelisted you.

What follows is a list of 3 ways that you can use jQuery to detect AdBlock software.

1. Detect AdBlock

Detect AdBlock is a website that offers real, easy to implement solutions to detect AdBlock software on your websites using JavaScript. The code is provided by AdBlock Analytics, who gives you step-by-step instructions on how to effectively detect whether or not your users are blocking your ads. Once the ad blockers are detected, Detect AdBlock gives you three options for how to proceed: you can send the data to Google Analytics, you can save and post the data to an external script, and/or you can display a custom message to your user. This is a great, easy solution for detecting ad blocking software. 

2. Code Synthesis Ad Blocker Detection Plugin

Code Synthesis' solution to detecting ad blocking software uses jQuery. The method of detection is to create a "dummy" ad container that, if installed, the ad blocking software will interpret as an ad and try to suppress. If this happens, then you know that your user is utilizing ad blocking software, and this particular code snippet gives you the option of displaying a custom message to your user(s). 

3. Adi.js

Adi.js is sort of a less hands-on approach compared to the other two ad blocking solutions we've already presented. That's because Adi.js is actually a plugin that you can install onto your projects, rather than code snippets that you have to insert yourself. Once you've installed the plugin, you only need to call any of the built-in functions to detect ad blocker software and execute a reaction to the software if it's found. This plugin is lightweight, super easy to install, and even easier to use. A great option for if you're trying to quickly add an ad blocking software detection functionality to your site or projects. 


Nothing shocks me, I'm a Software Engineer. And I am not young enough to know everything. I live in World Wide Web and from there take care of this website. This website communicates about my work, learning and experience. I believe life is short, and it is for loving, sharing, learning and connecting. So lets connect..