CookieBot integration into Craft CMS 3 or 4.
This plugin requires Craft CMS 3.0.0 or later.
- Install with Composer via:
composer require balazscsaba2006/cookiebot - Navigate to
Settings -> Pluginsand click the "Install" button
- Navigate to
Settings -> Pluginsand configure settings for Cookiebot
If you create a config file in your config/ folder called cookiebot.php, you can override
the plugin’s settings in the Control Panel. Since that config file is fully multi-environment aware, this is
a handy way to have different settings across multiple environments.
Here’s what that config file might look like along with a list of all of the possible values you can override.
<?php
return [
'domainGroupID' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
'defaultPreferences' => true,
'defaultStatistics' => true,
'defaultMarketing' => false
];Can be used to render dialog and declaration script on Twig templates
{{ craft.cookiebot.dialogScript()|raw }}{{ craft.cookiebot.declarationScript()|raw }}{# dialog script #}
{{ craft.cookiebot.dialogScript(craft.app.locale.id)|raw }}
{# declaration script #}
{{ craft.cookiebot.declarationScript(craft.app.locale.id)|raw }}Can be used to check for consent on certain cookie categories like: Preferences, Statistics and Marketing.
{% if craft.cookiebot.hasConsent %}
{# ... #}
{% endif %}Preferences:
{% if craft.cookiebot.hasPreferencesConsent %}
{# ... #}
{% endif %}Statistics:
{% if craft.cookiebot.hasStatisticsConsent %}
{# ... #}
{% endif %}Marketing:
{% if craft.cookiebot.hasMarketingConsent %}
{# ... #}
{% endif %}