Skip to content

balazscsaba2006/craft-cookiebot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CookieBot for Craft2

CookieBot integration into Craft CMS 2.

Install

  • Add the cookiebot directory into your craft/plugins directory.
  • Navigate to Settings -> Plugins and click the "Install" button.
  • Navigate to Settings -> Plugins and click on settings for Cookiebot

Usage

Can be used to render dialog and declaration script on Twig templates

Render dialog script:

{{ craft.cookiebot.dialogScript()|raw }}

Render declaration script:

{{ craft.cookiebot.dialogScript()|raw }}

Render dialog/declaration script in a certain language:

{% set locale = craft.i18n.getCurrentLocale() %}
{{ craft.cookiebot.dialogScript(locale.id)|raw }}

Can be used to check for consent on certain cookie categories like: Preferences, Statistics and Marketing.

Checking for any consent:

{% if craft.cookiebot.hasConsent %}
    {# ... #}
{% endif %}

Checking for consent on a specific category:

Preferences:

{% if craft.cookiebot.hasPreferencesConsent %}
    {# ... #}
{% endif %}

Statistics:

{% if craft.cookiebot.hasStatisticsConsent %}
    {# ... #}
{% endif %}

Marketing:

{% if craft.cookiebot.hasMarketingConsent %}
    {# ... #}
{% endif %}