New: Pandectes in Claude & ChatGPT - ask your AI assistant about your cookie banner, scans and consent rates

New: Pandectes in Claude & ChatGPT See how it works

← All posts

Google

How Google Tag Manager Works with Cookie Consent

Google Tag Manager logo next to a cookie

Introduction

Google Tag Manager works hand in hand with cookie consent and Consent Mode to help businesses meet the requirements of the General Data Protection Regulation (GDPR), CCPA/CPRA, and LGPD. Most tags in GTM, such as Google Analytics, ad pixels, and social media tags, can collect personal information, so they must rely on lawful user consent before they fire.

Regulators in the EU, UK, Brazil, and several US states now expect clear consent banners, granular consent categories, and verifiable proof that tools like GTM respect the user’s consent state. For Shopify merchants, Pandectes offers a consent management solution that integrates directly with Google Tag Manager to automate much of this complexity.

A Google-Approved Consent Platform for Shopify

Pandectes is an official Google Certified Consent Management Platform and is fully compatible with Google Consent Mode v2 and global privacy regulations.

View the App on Shopify

What Google Tag Manager Is and What It Actually Does with Cookies

Google Tag Manager (GTM) is a tag management container that stores tag configurations, triggers, and variables. It lets marketers deploy Google Analytics 4, Google Ads, Meta Pixel, TikTok Pixel, and other tracking codes without editing site code directly.

Here is what often surprises store owners: Google Tag Manager does not set cookies by itself. The only GTM-related cookies are temporary, strictly necessary cookies created when preview mode is active for the person testing the container. Regular visitors never receive a Google Tag Manager cookie from the container alone.

For compliance, the real question is not “does tag manager use cookies?” but rather:

  • Which tags inside GTM set first-party cookies or third-party cookies?
  • Do those tags collect user data before consent exists?
  • Are they blocked until the user grants consent?

For a closer look at the legal side, see how Google Tag Manager integrates with cookie consent and the GDPR.

The GDPR has applied since May 2018. Together with the ePrivacy Directive, it means websites need consent before collecting data through non-essential cookies. Enforcement has steadily intensified through 2026, with regulators issuing fines for tracking without valid consent.

The main data protection regulations impacting GTM usage include:

Law Region Consent Model
GDPR / ePrivacy EU/EEA Opt-in required
UK GDPR United Kingdom Opt-in required
CCPA / CPRA California, US Opt-out model
LGPD Brazil Consent or Legitimate Interest (Opt-in for sensitive data)

A consent banner is a visible consent dialog that appears on a visitor’s first visit. Cookie banners must provide clear options for acceptance, rejection, and customization of consent choices, for example, letting users interact with categories like “Necessary,” “Analytics,” and “Marketing.”

Each user consent choice must translate into a technical consent state (granted or denied per category) that tools like GTM and Google Analytics can read. Regulators also require that consent can be withdrawn at any time via a persistent link, and that this revocation immediately stops further tracking and updates tag permissions.

Laptop showing an online store with a cookie banner offering Accept and Reject

Pandectes GDPR ComplianceThe most popular & reviewed GDPR app for Shopify 5/5 · 3,120 reviews · Built for ShopifyInstall free on Shopify

A consent management platform is the brain behind consent banners, consent logs, and enforcement. GTM requires third-party solutions for comprehensive cookie consent management because its built-in features alone cannot handle the full scope of banner display, logging, and multi-law compliance.

A CMP like Pandectes provides:

  • Customizable consent banners with branding, multilingual support, and region-based rules.
  • Automated cookie scanning and categorization (necessary, analytics, marketing, functional) using the Pandectes Cookie Scanner.
  • A consent overview dashboard showing who consented to what and when.
  • Integration hooks for GTM and Google Consent Mode v2.

Consent management platforms store and communicate user consent preferences to GTM. The CMP collects the visitor’s consent choice and converts it into a structured consent status, for example, analytics_storage=‘granted’ or ad_storage=‘denied’, that gets passed to GTM. Because Pandectes is a Google-certified consent management platform, it satisfies Google’s requirements for Google Ads and Google Analytics measurement data in the EEA and UK.

Understanding how Google Tag Manager works with cookie consent requires following a specific sequence of events on each page load:

  1. Visitor lands on the site. No analytics or advertising tags should fire yet.
  2. The CMP loads and displays the consent banner as early as possible.
  3. The CMP sets a default consent state, usually “denied” for all non-essential categories.
  4. GTM reads this consent state via Consent Mode and internal consent checks. Non-essential tags do not fire until user consent is granted.
  5. Only strictly necessary scripts execute at this stage (e.g., payment gateway scripts, core Shopify functions).

Google Tag Manager interacts with cookie consent management platforms by listening to visitor consent signals. Once the visitor accepts or customizes cookies, the CMP updates the consent state and pushes an update event into GTM’s dataLayer. Consent Mode signals update after user consent choices, allowing GTM to re-evaluate triggers and consent checks in real time.

This allows Google Analytics, Google Ads, and other tags to fire on the same page without needing a reload. Tags in Google Tag Manager must respect user consent choices at every step.

User consent preferences persist across page views in compliance with privacy regulations, so returning visitors are not asked again unless their consent expires or is withdrawn. The consent state acts as a persistent signal reused across the session and subsequent visits.

Google Consent Mode is Google’s mechanism for adjusting how Google tags behave depending on a user’s consent status. Consent Mode was updated in November 2023, introducing what is commonly called Consent Mode v2. Since March 2024, advertisers targeting the EEA and UK must send the Consent Mode v2 signals to preserve full ad measurement and audience features, and Google recommends doing so through a certified CMP.

Alongside secondary functional and security storage types (functionality_storage, personalization_storage, and security_storage), Consent Mode v2 focuses on four core advertising and analytics signals:

Parameter Controls
ad_storage Advertising cookies for Google Ads and Floodlight
analytics_storage Analytics cookies for Google Analytics
ad_user_data Whether user data can be sent to Google for ad purposes
ad_personalization Personalized advertising and remarketing features

The system works by:

  • Setting a default consent state (typically all “denied”) using the Consent Initialization trigger.
  • Updating the consent state when the CMP records the visitor’s consent choice.
  • Passing the final consent state on every hit to Google Analytics and Google Ads.
  • Basic Consent Mode: Google tags are completely blocked from loading or executing until the user explicitly consents. No pings are sent before consent.
  • Advanced Consent Mode: Google tags load with default “denied” states and send cookieless pings when consent is missing. Behavioral and conversion modeling in Google Analytics and Google Ads then fills measurement gaps while honoring user privacy preferences.

Man working at a desk with several monitors

Make Your Shopify Store GDPR & Cookie Compliant in Minutes

Start Free on Shopify

Integrating a CMP Like Pandectes with GTM and Google Analytics

When a CMP powers the consent banner, and GTM acts as the orchestration layer, tag setup becomes significantly cleaner. You can follow the full Pandectes GTM setup guide for detailed instructions.

High-Level Integration Steps

  1. Install the CMP (e.g., Pandectes) in your Shopify store.
  2. Enable Google Tag Manager, Google Analytics, and Google Consent Mode integration inside the CMP settings.
  3. Add the Pandectes GTM template to GTM and fire it on the “Consent Initialization - All Pages” trigger.

How Consent State Synchronization Works

  • The CMP determines the user’s consent choices and communicates them to GTM.
  • The CMP’s GTM template uses Google’s Consent Mode APIs (setDefaultConsentState, updateConsentState) to map user preferences to ad_storage, analytics_storage, ad_user_data, and ad_personalization.
  • All Google tags in GTM read the updated consent state automatically, while non-Google tags rely on GTM’s built-in consent checks to know when they are allowed to fire.

Pandectes auto-categorizes cookies and maps them to GTM consent types, reducing manual work. Using a Google-certified CMP simplifies audits because consent status and tag behavior are aligned and logged in one place.

Not all tags are Google tags. Heatmaps, chat widgets, review tools, A/B testing platforms, and affiliate trackers may all collect personal information. Because non-Google tags do not natively read Consent Mode signals, GTM will not block them automatically, meaning each of these tags needs manual consent configuration.

Audit your GTM container for tags that:

  • Set any cookies (first-party cookies or third-party cookies).
  • Send IP addresses, emails, or other identifiers to external vendors.
  • Load additional scripts via form submissions or user interactions that may themselves place cookies.

Assign Additional Consent requirements in each tag’s consent settings inside GTM: require analytics_storage for tools like Hotjar, ad_storage for retargeting pixels like Meta or TikTok, and functionality_storage for chat or personalization tools. For scripts loaded outside of GTM, Pandectes Auto-Blocking Technology can automatically hold back third-party trackers until visitors give consent.

Complex scenarios include:

  • Multi-region setups where EU/UK visitors see a strict opt-in consent banner while US visitors see an opt-out or simplified banner. CMPs should support regional configurations to comply with local privacy laws.
  • Returning visitors who change consent preferences via a persistent “Cookie settings” link, immediately updating consent status in GTM and stopping disallowed tags from firing on subsequent actions.

Here are the most frequent errors that create compliance risk, and how to fix them:

  • Loading the consent banner too late. If analytics tags fire before the CMP sets the default consent state, the first pageview is tracked without consent. Always fire your CMP tag on the Consent Initialization - All Pages trigger.
  • Omitting ad_user_data and ad_personalization. Setting only ad_storage and analytics_storage is incomplete under Consent Mode v2 and restricts Google Ads remarketing and conversion modeling.
  • Leaving third-party tags without consent checks. A custom HTML tag or third-party tracking pixel with no required consent configured in GTM will ignore the visitor’s consent choice entirely.
  • Not updating consent state on revocation. If users interact with a “Cookie settings” link and withdraw their consent, the CMP must push an updated consent state immediately so disallowed tags stop firing.
  • Assuming a banner alone is enough. Merchants often misinterpret GTM’s role and believe that simply displaying a consent dialog guarantees compliance, even though tags inside GTM continue to fire if triggers and consent checks are not configured properly.

Conclusion

Getting Google Tag Manager and cookie consent right is no longer optional. With Consent Mode v2 enforced for EEA and UK traffic, regulators issuing fines, and Google restricting measurement features for non-compliant sites, the stakes are real. Once you understand the sequence, where the CMP sets defaults, GTM reads consent signals, and tags respect user preferences, the system is logical and repeatable.

Start by auditing your current GTM container, configure consent requirements for every tag, and connect a certified consent management platform like Pandectes to handle the heavy lifting. Your customers get transparency, your measurement data stays as complete as possible, and your store avoids the legal and platform risks that come with getting this wrong.

Make your Shopify Store's use of cookies and online tracking compliant today

Try for free