Skip to content
Québec Studio

Craft CMS extension

Cookie Consent Kit

Cookie consent, done right: no third-party cookie before the visitor agrees, and pages that stay cached. Built for Quebec’s Law 25.

Craft CMS 5
v5.0.8
Craft CMS 6
v6.0.10
Editions
Lite (free), Pro
Also for
Statamic, Laravel

Settings

Every setting the plugin reads. Where they are stored and how they are edited is covered by Configuration.

Reference

SettingTypeDefaultWhat it does
cookieNamestringcookie_consentCookie that stores the decision. Accepts $ENV_VAR.
cookieMaxAgeint15552000Lifetime of that cookie, in seconds (180 days).
versionint1A stored decision with another version is treated as absent.
defaultLanguagestringenLanguage used when the site's language has no wording file.
policySourceper site—entry or url. Inferred from what is set when absent.
policyEntryper site—[<entry id>]. Craft only.
policyUrlstring or per site/politique-de-confidentialitePolicy link. Accepts $ENV_VAR. A site missing from a map gets the default.
autoInjectbooltrueAppends the banner to every site page. Never to the control panel.
templateRootstring_consentSite template folder whose templates replace the plugin's.
colorSchemestringautoauto, light or dark.
backdropStylestringblurBehind the manage panel: blur, dim or none.
displayModestringfullfull, floating, corner-left or corner-right. Full width under 40rem. See Styling.
reopenButtonbooltrueTab that reopens the banner once a decision is stored.
reopenPositionstringautoSide of that tab: left, right, or auto, which follows displayMode (right for corner-right).
gpcHidesBannerbooltrueSkips the banner for a browser sending Global Privacy Control.
analyticsCategorystringstatisticsCategory granting Matomo and analytics_storage. Empty grants nothing.
marketingCategorystringmarketingCategory granting ad_storage, ad_user_data and ad_personalization. Empty grants nothing.
videoFacadebooltrueYouTube videos load on click.
videoThumbnailsbooltrueThe facade shows the YouTube thumbnail, fetched and served by the site.
videoConsentCategorystring''Category whose consent loads videos without the facade. Empty keeps the facade.
inventoryFrameworkstring''Class set of the cookie table: '', bootstrap, bulma, tailwind or custom.
inventoryClassesmap[]Classes per table element, used with custom.
categoriesmapshipped categoriesCategories and their cookies, in display order.
registryboolfalsePro. Records decisions server-side. See Register.
registryUserbooltruePro. Records the signed-in user with their decision, when there is one.
registryRequestContextboolfalsePro. Records the visitor’s address and browser. Makes the register personal data.
registryGraceint12Pro. Months a record is kept beyond the life of the consent cookie. Zero keeps everything.

Per-site settings

policySource, policyEntry and policyUrl are maps keyed by site id or site handle. A key is looked up as an id, then as a handle:

'policyUrl' => [
    'default' => '/politique-de-confidentialite',
    'english' => '/en/privacy-policy',
],

A plain string applies to every site.

version

Increase it when a cookie is added to an optional category, a category is added, or a purpose changes. Every visitor is asked again. Renaming cookieName has the same effect.

Categories

'categories' => [
    'necessary' => [
        'required' => true,
        'label' => ['default' => 'Necessary'],
        'description' => ['default' => 'Required for the site to work.'],
        'cookies' => [
            'craft-session' => [
                'name' => 'CraftSessionId',
                'provider' => null,
                'purpose' => ['default' => 'Keeps your browsing session.'],
                'duration' => ['default' => 'Session'],
            ],
        ],
    ],
    'statistics' => [
        'required' => false,
        'label' => ['default' => 'Statistics'],
        'description' => ['default' => 'Help us understand how the site is used.'],
        'cookies' => [
            'ga' => [
                'name' => '_ga',
                'provider' => 'Google (google-analytics.com)',
                'purpose' => ['default' => 'Distinguishes visitors.'],
                'duration' => ['default' => '2 years'],
            ],
        ],
    ],
],
KeyWhat it is
category handle (statistics)Identifier shared by every site; stored in the consent cookie
requiredAlways on, not shown as a choice. Only necessary is required.
label, descriptionPer site, keyed by site handle. A plain string applies to every site.
cookie handle (ga)Identifier of the cookie across sites and across renames
nameTechnical name. {cookieName} is replaced with cookieName.
providerWho sets it. null is the site itself.
purpose, durationPer site, keyed by site handle

Rules

  • A category with no declared cookie is not shown in the banner.
  • Optional categories always start unchecked.
  • necessary cannot be removed.
  • A site with no wording of its own shows the wording of its language from the language files, then another site's.

Shipped categories

necessary, with the cookies Craft and the plugin set; statistics and marketing, with none. They are written into the settings when the plugin is installed, each site worded in its language.

Removing a category

  • Its cookies are removed with it.
  • Visitors who accepted it keep it in their consent cookie until version changes. window.qsmConsentKit.granted('<handle>') returns true for them.
  • Tags marked data-consent="<handle>" are no longer activated.

A Craft CMS extension that doesn’t exist yet?

If Craft CMS doesn’t do what you need yet, we can build it for you.

Let’s talk

We use cookies

This site uses cookies that are required for it to work. With your consent, we also use cookies to measure traffic. You can change your mind at any time. Privacy policy

Your cookie preferences

Always on

Required for the site to work and for form security. These cannot be turned off.

Necessary
Cookie Set by Purpose Retention
CraftSessionId This site Keeps your browsing session. Session
CRAFT_CSRF_TOKEN This site Protects forms against cross-site request forgery. Session
cookie_consent This site Remembers your cookie choices. 6 months

Help us understand how the site is used so we can improve it. Measured with Matomo.

Statistics
Cookie Set by Purpose Retention
_pk_id.* This site Recognizes the browser from one visit to the next, without identifying you. 13 months
_pk_ses.* This site Groups the pages viewed during a single visit. 30 minutes