Back to all articles
Google Tag Manager
Cookie Consent
Consent Mode v2
GTM
GDPR
Google Analytics
Tutorial
8 min read

Google Tag Manager Cookie Consent: Complete Setup Guide (2026)

Set up Google Tag Manager cookie consent with Consent Mode v2. Step-by-step — banner script, GTM template, test, publish. About 10 minutes.

Ask about Canadian cookie compliance
Create a free account to ask questionsSign up freeSign in
Direct Answer: Complete GTM cookie consent needs two pieces: (1) the Cookie Banner Generator script on your site, and (2) the Consent Mode v2 tag in GTM on Consent Initialization — All Pages with defaults set to denied. The banner collects the choice; the GTM tag tells Google tags what to do before they fire.

Start a free banner →

About 10 minutes. Free banner + GTM template. Start a free banner GTM install page

Table of Contents

The same steps, with the download button, are on the GTM install page.


Do these four steps

Create a free banner first if you do not have one. The same clicks, with a download button, are on the GTM install page.

1. Import the template

Download cookie-banner-consent-mode.tpl first.

  1. In Google Tag Manager, click Templates in the left menu.
  2. In the Tag Templates box, click New. A blank editor opens.
  3. Click the three dots at the top right, next to Save. Click Import and pick cookie-banner-consent-mode.tpl from your Downloads folder.
  4. The name changes to Cookie Banner Generator — Consent Mode v2 and you see Template created. If Save is blue, click it. Close the editor with the X at the top left.
  5. Click Tags, then New. Name it Cookie Banner Generator — Consent Mode.
  6. Click Tag Configuration and choose Cookie Banner Generator — Consent Mode v2. Leave every field as it is. An empty table means everything starts as denied.
  7. At the bottom of the Tag Configuration box, click Advanced Settings, then Tag firing priority. Type 1000.
  8. Click Triggering and choose Consent Initialization - All Pages.
  9. Click Save.

If you see a red error after importing, stop and email support@cookie-banner.ca with a screenshot.

2. Add the banner

Grab your banner and click Copy snippet on the banner.

If GTM is how you install things:

  1. In GTM, click Tags, then New.
  2. Name the tag Cookie Banner.
  3. Click Tag Configuration, choose Custom HTML, and paste the snippet.
  4. At the bottom of the Tag Configuration box, click Advanced Settings, then Tag firing priority. Type 50.
  5. Click Triggering and choose Consent Initialization - All Pages.
  6. Click Save.

If you can edit the site HTML: paste that same snippet in the head, above the Google Tag Manager snippet. You still need the template from step 1.

3. Tell each other tag to wait

Stay in the same Google Tag Manager container. In the left menu, click Tags. That list is the tags that were already firing on the site, plus the two you just created.

Open a tag that was already there, such as Google Analytics or a Meta pixel. Leave Cookie Banner Generator — Consent Mode and Cookie Banner as you saved them.

  1. In the left menu, click Tags.
  2. Click the name of an existing tag. Skip the two tags from steps 1 and 2.
  3. Click inside the Tag Configuration box to edit it.
  4. At the bottom of that box, click Advanced Settings.
  5. Click Consent Settings.
  6. Select Require additional consent for tag to fire.
  7. Check the boxes below for that kind of tag.
  8. Click Save at the top right.
  9. Click Tags again and open the next existing tag. Stop when the only tags you have not changed are the two from steps 1 and 2.

| Tag | Check | |---|---| | GA4 | Analytics Storage | | Google Ads | Ad Storage, Ad User Data, Ad Personalization | | Meta, LinkedIn, TikTok, other ad pixels | Ad Storage | | Hotjar and other analytics | Analytics Storage |

If Consent Settings is missing, the tag is usually Custom HTML. Open Triggering, remove All Pages, and add a Custom Event trigger named cookie_consent_update. Fire it when consent_marketing equals true for an ad pixel, or consent_analytics equals true for an analytics tool.

4. Preview, then publish

  1. Click Preview at the top right. Enter your site address and click Connect.
  2. Leave the banner sitting there. In Tag Assistant, open the Consent tab. Ad Storage, Analytics Storage, Ad User Data, and Ad Personalization should say Denied.
  3. Click a GA4 or ads tag. It should say it has not fired, or that consent blocked it. Refresh. It should still be blocked.
  4. On the banner, click Accept All. Those tags should say Fired.
  5. Refresh. The tags should fire again, and the banner should stay hidden.
  6. In GTM, click Submit, name the version, and click Publish.

Common mistakes

  1. Searching the Community Gallery for this template. Download the file in step 1 and import it.
  2. Wrong trigger. Use Consent Initialization, not All Pages.
  3. Banner only, on All Pages. The default is set too late. Import the template.
  4. No Denied row. GTM treats a missing default as granted.
  5. Priority 9999 on the banner tag. That starts the tag earlier. It does not wait for the banner file.
  6. Meta or LinkedIn with no consent setting. Consent Mode does not block those tags by itself.
  7. Wrong script URL. Use https://www.cookie-banner.ca/api/v1/banner.js?id=… from the dashboard.

Background: why this matters

Skip this if you only needed the setup. Useful context for audits and Ads accounts.

GTM is a container. GA4, Google Ads, Meta, LinkedIn inside it set tracking cookies. Under GDPR cookie rules (and similar laws), those tags must wait for permission.

| Signal | Controls | |---|---| | ad_storage | Ads / remarketing cookies | | analytics_storage | Analytics cookies (GA4) | | ad_user_data | Sending user data for ads (required since Mar 2024) | | ad_personalization | Personalized ads (required since Mar 2024) |

Denied → cookieless pings + modelling. Granted → normal cookies.

Basic vs Advanced

  • Basic: tags do not fire until consent — simplest, lose all non-consent data.
  • Advanced: cookieless pings when denied — better modelled coverage; still no cookies without consent. Our template is built for Advanced.

Without v2 signals in the EEA/UK you lose remarketing lists, modelled conversions, and audience features. GA4 uses behavioural modelling when analytics_storage is denied.

How our pieces talk

  1. Consent Initialization → template sets Denied (+ wait_for_update)
  2. Template reads cookie_consent for returning visitors and updates immediately
  3. Banner loads → UI for new visitors
  4. User chooses → banner updates gtag, pushes cookie_consent_update, notifies the GTM template callback
  5. Google tags follow Consent Mode. Other tags follow the consent setting from step 3.

Full install reference: /integrations/google-tag-manager.


Frequently Asked Questions

Answer: Yes. GTM itself is not the tracker — the tags inside it are. Those need consent before they set non-essential cookies.

Answer: A Google framework with four consent signals (ad_storage, analytics_storage, ad_user_data, ad_personalization) that change how Google tags behave when consent is denied or granted.

Do I need both the banner script and the GTM template?

Answer: Yes for a complete setup. The banner is the UI + storage. The template sets defaults early and keeps Google tags in sync.

Answer: Basic blocks tags until consent. Advanced sends cookieless pings when denied so Google can model. Prefer Advanced for most sites.

Answer: Yes for EEA/UK remarketing and conversion features since March 2024 (ad_user_data and ad_personalization).

Answer: Yes. Import the template first (priority 1000, defaults denied, Consent Initialization). Add the banner as Custom HTML on that same trigger at priority 50. If you can edit the site, put the banner script in the head before GTM instead.

Does this work with Google Analytics 4?

Answer: Yes. GA4 respects Consent Mode natively. Denied → cookieless pings; granted → full tracking.

What is ads data redaction?

Answer: When enabled and ad_storage is denied, Google strips ad-click IDs like gclid from requests. Turn it on for stricter privacy.


Ready? Create your free banner, run the steps above, Preview, then Publish. Full reference: GTM integration.

Next step

Ready to add a cookie banner?

Create a free banner in minutes and paste it onto your site. No signup required.

Free plan: 1 banner on unlimited sites. Pro is $99 one-time.