For a live example visit here
To view the read me visit here
What exactly does a "Saurdo Adblock Counter" do? Well it counts Adblocks! Using this program you can detect just how many visitors on your website are blocking ads using adblock and compile some adblock statistics. Not only that, but you can set the program up to automatically display a message in the place of a blocked add. All you have to do is put all of your ads in a div container with a special class name, embed the script into the page, and start gathering your visitor data!
What inspired such a creation? Well, i've been playing with the underlying methodology behind this program for quite some time. In a previous post I went into some detail about how exactly the program works and shared my rather surprising results. Since then I have gotten a number of e-mails requesting the very program I am releasing today. So here it is! Using my handy guide, I was able to make it so that a message is displayed in the place of any blocked ads! That way you can kindly ask them to whitelist you and explain to them how ads keep your site running.
To view the recorded results you must navigate to the "adblocks.txt" file which will be in the same directory as the "adblocks.php" file. The first number is the amount of impressions, the second number is the amount of impressions that had adblock on. To get the percentage of impressions using adblock, divide the second number by the first.
1. The first thing you need to do is modify the webpage you plan to embed this script on. Wrap all the ads you wish to get statistics of in a div tag and give them all the same unique class name. View the "example.html" file for an example of this. Make sure that the ad script is the only thing inside the DIV tags and that all the DIV tags have the same class name. I recommend not using a name like "ads" because some adblockers tend to completely disable those divs, thus preventing the blocked message system from working.
3. Open the "adblocks.js" file in a regular text editor like notepad. On the first line set the "ads" variable to the same class name that you gave the DIV's in the first part of the instructions.
4. On the next line change the "msg" variable to the message that will display in the place of any ads that are being blocked. You may choose to make this blank if you don't want to use thsi feature.
If you choose to provide a direct URL path for the PHP file use 'http://"+document.location.hostname+' for the main part of your website's name. For example if the direct URL path to my php file was located at "http://www.saurdo.com/files/adblocks/adblocks.php". I would put "var php_url = 'http://'+document.location.hostname+'/files/adblocks/'"
6. Save everything, upload it, and test! If it just won't work then please contact me, not only will I probably get it to work for you, but you will be providing me with information that will help me make it easier for everyone else.
If you have any problems, suggestions, or comments please do not hesitate to contact me. I am more than happy to help.
Thanks for downloading!