owebstudio / kirby-detect-adblock
This plugin helps you detect ad blockers and manage the warning messages that will be displayed for Kirby 3.
Package info
github.com/owebstudio/kirby-detect-adblock
Type:kirby-plugin
pkg:composer/owebstudio/kirby-detect-adblock
1.0.2
2022-09-14 20:07 UTC
Requires
- php: ^7.4|^8.0
- getkirby/composer-installer: ^1.2
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
This plugin helps you detect ad blockers and manage the warning messages that will be displayed for Kirby 3.
Installation
- Download the latest release
- Unzip downloaded file
- Copy/paste unzipped folder in your
/site/pluginsfolder
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>
Options
The default values of the package are:
| Option | Type | Default | Description |
|---|---|---|---|
| title | string | AdBlock detected! | Overlay title |
| text | string | Please disable AdBlock and refresh to see requested page. | Overlay text |
| button | string | Refresh the page | Overlay button text |
All the values can be updated in the config.php file and prefixed with owebstudio.detect-adblock..
Sample options
<?php // /site/config/config.php return [ 'owebstudio.detect-adblock' => [ 'title' => 'Warning! ', 'text' => 'Looks like you are using ad blocker. Please disable and refresh the page!', 'button' => 'OK', ] ];