A blog for technology, SEO tips, website development and open source programming.

Ad Blocker Detector with Javascript

0 657

Advertisements are very important for any post published in internet. This is what decides the person’s revenue. Recently adblocker system is killing revenue of the publisher because of which it also effects the creativity of that person. The post, will provide a simple solution for those depressed and effected persons of adblocking system. Here is a simple javascript to be included along with your website code to either hide the content of your website or show a pop-up or alert message to remove the viewers adblock plugin. Any blogger or any website management can use this code to improve your revenue of your website.

Follow me on Instagram

The code is mainly designed for Google Adsense.

Google Adsense
You have to include onerror event to the script tag, this will trigger adBlockFunction()Javascript function.

Ad Blocker Function
This contains very simple JavaScript code, this will replace article content part with ad blocker message. If you are Google Blogger user don’t change the class name post-body-n. This function helps you to track ad blocker usesr count with Google Analytics.

Sample Website HTML Code

List of all Javascript Articles: http://www.panayiotisgeorgiou.net/category/javascript/

Follow me on Twitter


Follow me on Github

Subscribe to my Youtube Channel

Leave a Reply

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More