AdBlock Tracker & Usergroup Swap

AdBlock Tracker & Usergroup Swap v2.3.2

No permission to buy ($45.00)
How can I recognize AdBlockers that are Guests in my templates?

You can add an option to your config.php as follows. I recommend you use a unique variable name in your config. This example uses: isAdBlocking

Update your config.php as shown below.

Please ensure you have guest tracking enabled in the Add-On options or the following will changes will have no effect within templates for guests:

Config.php Update
PHP:
/* AdBlock Tracker and Usergroup Swap */
/* https://xenforo.com/community/resources/adblock-tracker-usergroup-swap.7530/field?field=faq */
$config['adBlockTrackerGuestSession']['enabled'] = true;
$config['adBlockTrackerGuestSession']['config'] = [
    'variable' => 'isAdBlocking', // recommend using something unique here
    'removeOnNonDetect' => true,
    'forceRemoval' => false,
];

You can access the following in your templates once this is set.

Here's an example:

Code:
<xf:if is="$xf.session.isAdBlocking">
    <div style="background-color:#f8d7da;color:#721c24;padding:20px;border-radius:8px;">
        <p>Ad Blocking Detected!</p>
        <p>Pages counted: {{ $xf.session.isAdBlocking }}</p>
    </div>
</xf:if>

By default, your variable (isAdBlocking in this example), will be the count of the number of page views AdBlocked consecutively. If the AdBlocker is disabled the session variable will be unset and cleared.

Note, depending on your caching system you may need to enable forceRemoval. This will delete the sessionId from the database directly. Use at your own risk.

The AddOn is enabled, but it doesn't seem to be tracking people yet, why?

Are you testing using an Incognito window, or when you're not logged in to your website?

If so, be patient. You likely have page caching on (CloudFlare, Redis, XF). If so, it'll take a while for the caches to expire and the tracking code to be placed on the pages for detection. Please give it a few days or weeks.

The easiest way to test is to use a Registered User, but ensure their permissions are set so that they're targeted for detection.

My charts page shows a dash for Current Usergroup and Past Usergroup, why?

You must run the software for a few days and disable "track-only" mode. Current Usergroup and Past Usergroup will only change in value when users have been moved to and from usergroups (therefore this must be enabled).

You must specify a usergroup to move "AdBlockers" to when they're detected AdBlocking.
Back
Top Bottom