Skip to content
This repository has been archived by the owner on Oct 14, 2022. It is now read-only.
Thomas Maier edited this page May 31, 2013 · 20 revisions

About

This plugin counts visitors to a WordPress website that have adblock enabled and so don't see any advertisements.

This is just the basic plugin that measures and counts. There will be additional plugins for better analyzation or integration.

Arguments to use this plugin

  • know the facts, don't guess
  • analyze adblock users (with our premium add ons) to really understand them before blocking them

known issues

  • doesn't work on multisites with sites in supdirectories (webgilde.com/en/ und webgilde.com/de/)
  • wenn WP Super Cache oder ein anderes Cache-Plugin aktiv ist, wird der nonce im Frontend nicht gleich gesetzt und bleibt erstmal leer; also wird auch nicht gezählt
  • breaks with Minify plugins, when the advertisement.js is listed between the other js files and filtered together with them; add adblock-counter-testjs as an exception for a js file that should not be included in the minify

Cookies set by the plugin

  • BaAdBlock => enabled or disabled if visitor has adblock enabled
  • BaUniqueVisitorId => ID set for the individual visitor
  • (deprecated since 1.2) AbcUniqueVisitorJsFile => set nonce when visitor was already checked with the missing advertisment.js file method; used to distinct, if visitor was already counted as unique
  • (deprecated since 1.2) AbcUniqueVisitorBanner => set nonce when visitor was already checked with the missing banner.gif file method; used to distinct, if visitor was already counted as unique
  • BaUniqueVisitor => set nonce, if visitor was already counted once

Constants

BA_ADBLOCK_ENABLED

use BA_ADBLOCK_ENABLED to check if AdBlocker is enabled

  • === false => AdBlock is disabled
  • === true => AdBlock is enabled
  • === 0 => plugin wasn't able to retrieve the information, yet (probably first page view of the visitor)

usage:

check with this:

if( defined('BA_ADBLOCK_ENABLED') && BA_ADBLOCK_ENABLED === true ) { // do stuff when adblock is enabled }

check with '== false' if you need to check if adblock is disabled or not sure (as default)

issues:

the constant is 0 on the first page view and you have to decide for yourself if the option you are blocking or the message you are showing should be processed on the first page view or not.

Hooks and Filters

Action Hooks

ba_js_footer

Ad additional JavaScript code in the footer after the measurement methods ran, so you can do appropriate js action or set more cookies

Filter Hooks

ba_stat_methods

add additional stat_methods

gets an array with information with this pattern:

methodslug => array(name, active, description)

defined in load_stat_methods()

Options saved

the following options are saved in the WP database:

ba_settings

array with following information

  • benchmark_category > Category of the site to check again others
  • methods > methods used to create stats

** others**

  • ba_version > version number of the installed plugin
  • ba_tracking_hash > hash value to send with tracking data to verify the source
  • ba_page_views > number of page views for the standard stat method
  • ba_unique_visitors > number of unique visitors for the standard stat method
  • ba_page_views_blocked > number of page with with AdBlock enabled for the standard stat method
  • ba_unique_visitors_blocked > number of unique visitors with with AdBlock enabled for the standard stat method
  • ba_last_reset > timestamp for last reset
  • ba_last_sent > last time data was successfully sent to the server to compare stats
  • ba_last_stats > last data received from the server