Ad Block Tracker
Categories
Component ID
Component name
Component type
Maintenance status
Development status
Component security advisory coverage
Downloads
Component created
Component changed
Component body
Detects if a user has an ad blocker enabled and tracks the following information:
- is it a new user or a returning user
- is the ad block enabled
- if it's a returning user if the ad block was enabled or disabled from the last visit
Triggers a JS event so that other modules can act on the information detected.
If Google Analytics is detected a GA event will be triggered.
Installation
1/ Download BlockAdBlock (https://github.com/sitexw/BlockAdBlock) library and put in you sites/all/libraries/blockadblock folder
2/ Enable the module
Dependencies
Libraries API - https://www.drupal.org/project/libraries
There is no dependancy on the Google Analytics module because some people may use an alternative way to load the Analytics script on their website such as through GTM or other tag manager.
Drupal 8 version
If this module is used by enough websites I will port this to Drupal 8
Writing your event handlers
The module triggers a custom JavaScript event for your custom modules and scripts to react to the adBlock presence or absence.
The event handler is added the following way:
(function ($) {
$(window).on('blocktracker', function (e, data) {
// Your code goes here.
});
})(jQuery);
data - will is a object containing 3 event properties that are used for the GA event.
