Tag Consent Banner for Craft CMS
Hold Google, Meta and other optional tags until visitors choose, with Google Consent Mode v2 and a consent log.
Coming to the Craft Plugin Store.
Install Tag Consent Banner
US$39 one-time per site (one Craft installation), including the first year of updates. Updates cost US$19/year after that. Craft offers a free trial on eligible development and staging environments. Craft trial guidance.
- Run
composer require brightdesk/tag-consent-banner, thenphp craft plugin/install tag-consent-banner. - Open Settings > Plugins > Tag Consent Banner. Set the consent lifetime, Policy version, and appearance. Necessary is always on.
- Add
{{ craft.tagConsent.head() }}near the top of<head>before Google tags. Add{{ craft.tagConsent.banner() }}beforeendBody()and{{ craft.tagConsent.settingsLink() }}in the footer. Callhead()andendBody()in the Craft layout.
Gate optional scripts
Assign scripts to analytics, marketing, or preferences. Put the gated loader before the gated configuration and keep the provider's required JavaScript setup before the config call. Pass only trusted JavaScript source to the Twig helper.
{{ craft.tagConsent.script('analytics', '', {src: 'https://www.googletagmanager.com/gtag/js?id=G-EXAMPLE'}) }}
{% set gaConfig %}
window.dataLayer = window.dataLayer || [];
window.gtag = window.gtag || function () { window.dataLayer.push(arguments); };
gtag('js', new Date());
gtag('config', 'G-EXAMPLE');
{% endset %}
{{ craft.tagConsent.script('analytics', gaConfig) }}
For HTML, replace the Twig loader with this inert script and keep it before the gated configuration.
<script type="text/plain" data-consent="analytics" data-consent-src="https://www.googletagmanager.com/gtag/js?id=G-EXAMPLE"></script>
Set up Google tags
Enable Google Consent Mode v2 in plugin settings. The plugin uses Basic mode. All optional signals default to denied before the gated loader. Analytics maps to analytics_storage. Marketing maps to ad_storage, ad_user_data, and ad_personalization.
Gate GA4-only loaders on analytics. A GTM container can hold mixed tags, and the default matcher requires analytics and marketing. Configure consent checks inside GTM. See the official Google consent guide.
Match known tags
Enable Match known tags and pass trusted markup.
{% set tracking %}
<script src="https://connect.facebook.net/en_US/fbevents.js"></script>
{% endset %}
{{ craft.tagConsent.autoBlock(tracking) }}
Only scripts recognized by loader URL or inline bootstrap are released. The matcher covers common GA4, GTM, Meta Pixel, Hotjar, Microsoft Clarity, LinkedIn Insight, and TikTok scripts. Gate other scripts manually. The matcher does not scan the site or block external embeds, noscript pixels, dynamic scripts, or preloads outside the block.
Set site-specific text
In the plugin settings, open Site text, select the Craft site and language, then enter the text override. The plugin uses the shared text when no override is set.
Check requests and choices
In the browser's Network pane, check which requests run before a choice, after a category grant, and after withdrawal. Withdrawal updates consent signals and reloads the page if active scripts need to stop. Existing third-party cookies may remain.
How do I ask visitors to choose again?
Change Policy version in the plugin settings.
Why does a tag still load?
Look for a copy outside gated markup, including in shared layouts and embeds.
What data is stored or sent?
With Record consent choices enabled, the plugin records the timestamp, site, category grants, current policy version, and a keyed rotating IP hash in the site database. It stores no raw IP. Export CSV from the Tag Consent Banner section of the Craft control panel. Configured retention runs when Craft garbage collects. The plugin sends consent records only to your site. It uses no SaaS or telemetry. Tags may send data to their own providers after consent.
Email support@brightdeskapps.com for help.
Version 1.0.0
Released 1 December 2026 with a cookie banner, manual script gating, Google Consent Mode v2, known-tag matching, site-specific text, and consent logging.