AdBlock Detection

Block users of ad-blockers from accessing your content

Kirby Detect Ad Block

This plugin helps you detect ad blockers and manage the warning messages that will be displayed for Kirby 3.

Installation

  1. Download the latest release
  2. Unzip downloaded file
  3. Copy/paste unzipped folder in your /site/plugins folder

Usage

You can use sample basic snippet of plugin:

<?php snippet('detect-adblock') ?>

If you want to customize overlay, you can override detect-adblock-overlay snippet like following:

<!-- /site/snippets/detect-adblock-overlay.php -->
<div id="custom-modal">
    <h3>Warning!</h3>
    <p>Looks like you are using ad blocker. Please disable and refresh the page!</p>
    <button type="button" onclick="location.reload();">OK</button>
</div>

All the values can be updated in the config.php file and prefixed with clicktonext.detect-adblock. .

Sample options

<?php

// /site/config/config.php
return [
    'clicktonext.detect-adblock' => [
        'title' => 'Warning! ',
        'text' => 'Looks like you are using ad blocker. Please disable and refresh the page!',
        'button' => 'OK',
    ]
];
2 Likes