Search by

1994 / cookie-connect-craft

1994

Connect your site to the cookie consent platform you already use: paste its ID, and get Google Consent Mode v2 in the right order.

Package info

github.com/1994limited/cookie-connect-craft

Documentation

Type:craft-plugin

pkg:composer/1994/cookie-connect-craft

Statistics

Installs: 5

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.1 2026-10-18 00:52 UTC

This package is auto-updated.

Last update: 2026-10-18 04:07:12 UTC


README

Connect your Craft site to the cookie consent platform you already pay for. Choose it in the control panel, paste its ID, and Cookie Connect loads it first in every page's <head>, sets up Google Consent Mode v2 in the right order, and holds back anything that needs consent until the visitor allows it. Switch platform later without touching a template.

It works with Cookiebot, Usercentrics, OneTrust, CookieYes, iubenda, Termly, CookieFirst and Cookie-Script, or any other platform through Custom. It doesn't draw a banner of its own: your platform does that.

Choose the platform, paste its ID Scripts held back until consent Before and after consent
The Cookie Connect page with Cookiebot chosen A Hotjar script added in the Scripts list A video held back behind a placeholder until marketing cookies are allowed

The screenshots are from Dog-ear Books, a made-up bookshop (see the demo). Its banner is a pretend consent platform for trying Cookie Connect without an account; on your site, it's your platform's own banner.

Features

  • Paste an ID, done. Pick the platform, paste the ID or the whole snippet your platform gives you (Cookie Connect takes the ID out of it), save. Nothing to add to your templates: it puts itself into every page, like SEOmatic does.
  • Google Consent Mode v2, in the right order. Consent Mode defaults (denied until the visitor says yes) first, then your consent platform, then Google Tag Manager or Google Analytics. Where the platform sets the defaults itself (iubenda, Termly), Cookie Connect doesn't set them twice. Basic or advanced mode, everywhere or only in the EEA, UK and Switzerland.
  • One way to mark scripts, for every platform. {% consent 'analytics' %}…{% endconsent %} prints Cookiebot's data-cookieconsent, OneTrust's optanon-category-… classes, Termly's data-categories and so on, whichever platform the site uses. Four categories: necessary, preferences, analytics, marketing.
  • Scripts without template changes. Paste Hotjar, a Meta pixel or a chat widget into the control panel, say what it needs, and it waits for consent.
  • Cookie settings links and the cookie declaration. Any link to #cookie-settings (in a navigation, a footer, a rich text field) reopens the platform's preferences. Type {cookie_declaration} into a page and your platform's cookie list appears there.
  • One JavaScript API. CookieConnect.has('analytics'), CookieConnect.on('change', …) and a cookieconnect:change event, the same whichever platform fired it.
  • Each site its own platform. Per-site settings on multi-site installs, kept in the database so they can be changed on a live site, or fixed in config/cookie-connect.php with environment variables.
  • Off on dev and staging. The platform only loads in the environments you choose. Elsewhere, content that needs consent stays blocked (or runs, to test your tags).
  • Plays well with others. If SEOmatic (or anything else) already adds Google Tag Manager, Cookie Connect doesn't add it again (when it adds itself to pages), and says so in the control panel. Works with Blitz and {% cache %}, and with a Content Security Policy (nonces or hashes).

Requirements

Craft CMS 5.6 or later, PHP 8.2 or later, and an account with a cookie consent platform.

Installation

composer require 1994/cookie-connect-craft
php craft plugin/install cookie-connect

Then open Cookie Connect in the control panel, choose your platform and paste its ID. By default it only loads in the production environment: change that under Settings → Plugins → Cookie Connect.

Documentation

Start with the documentation's contents.

Support

Email hello@1994.co.uk, or open an issue on GitHub. Questions about your consent platform's own settings (its banner, its cookie scan) are best asked of the platform.