How to Add Adblock Detection to Your Site for FREE with PubGuru Apollo

How to Add Adblock Detection to Your Site for FREE with PubGuru Apollo

Adblock has become the bane of existence for many publishers.  Percentages of Adblock rates vary by site vertical and geographical location breakdowns.  Most US traffic sites are at 10-20% adblock rates.  Some verticals, especially very technical coding sites, as well as video game sites, often see 70% or higher adblock rates.

In this guide, we’re going to show you how to set up adblock detection for free with PubGuru Apollo

Analytics and Reporting

When you add this code to your page, results are stored in Google Analytics (GA) by default.  This is intentional as we want you to be able to access reporting via an interface you already use.  Note: Google is a registered trademark of Alphabet Inc. and this adblock detection technology is not endorsed by or affiliated in any way with Alphabet, Google, or their affiliates.

You can change your analytics endpoints by removing all the GA code and overriding apollo.logBlocked() and apollo.logUnblocked() to whatever you want.  Some publishers want to do this because although most adblockers do not block GA, some adblockers and some plugins do (including Ublock Origin).  These users are very rare though, so using GA provides a solid, reliable pipeline for Adblock detection with minimal additional overhead.

This is also one of the reasons why the code must be put directly on the page.  You cannot simply link to it because popular Adblock repositories have repeatedly blocked domains that we’ve hosted this code on.

Licensing

PubGuru Apollo is licensed under the MIT license.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS,” WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

If you do not agree to this licensing, do not use this code.

Implementation

Copy and paste the source of this file into any pages you want to run Adblock detection with.  You must copy that source and put it directly on your page.  If you just link to the file, it will not and cannot work.

By default, sampling is set to 1% of traffic.  This is because GA only gives a certain amount of data points per day and if you run over your quota, you’ll lose pageview data.  If you want to change the sampling, modify the line with apollo.sampling to some number between 0.1 (0.1% of traffic) and 100 (all traffic).

In setting up the script, change apollo.verbose = true; to see the output.

Reading the Data

Once the code is live on your site, you can pull up your events section.  You will find a category called “Adblock (Pubguru Apollo)” and inside that category are event counts for how much adblock has been detected (or not).  Your adblock rate is the number of events there for the “blocked” label divided by the total of both unblocked and blocked events.

Kean Graham

CEO and Founder at MonetizeMore

Kean is the resident expert in Ad Optimization covering areas like AdSense Optimization, DFP Management, and third-party ad network partnerships. Kean believes in the supremacy of direct publisher deals and holistic optimization as keys to effective and consistent ad revenue increases.

Get our latest ad optimization tips delivered to your inbox

Submit a Comment

Your email address will not be published. Required fields are marked *