cmpGoogle Consent Mode v2Google Tag Managercookie consent

How to Set Up Google Consent Mode v2 in Google Tag Manager

Marcin
9 July 2026
6 min read
How to Set Up Google Consent Mode v2 in Google Tag Manager

Google Tag Manager (GTM) is often the control point for analytics, advertising pixels and ecommerce events. It is also where configuration errors can cause tags to run too early—or prevent measurement after a visitor has given consent.

This guide explains how to connect a consent management platform (CMP) to Google Consent Mode v2 in GTM, map consent categories and test the result. Consent Mode communicates a visitor’s choices to supported Google services; it is not a standalone compliance solution or a substitute for legal review.

For more background, read this overview of Google Consent Mode v2. Check implementation details against Google’s current technical documentation before publishing changes.

How a CMP, your website and GTM work together

A maintainable setup gives each layer a clear responsibility:

LayerResponsibilityPractical consideration
CMPCollects and records visitor choicesUse the CMP as the source of the consent state
WebsiteLoads the CMP and initializes consentEstablish the default state before optional tags run
GTMControls tag executionConfigure tags and triggers to respect consent choices
Google tagsReceive Consent Mode signalsHandle ad_storage, analytics_storage, ad_user_data and ad_personalization as configured
QA processVerifies the implementationTest rejection, partial consent and full consent after relevant changes

The exact mapping depends on the site’s CMP categories, tags and legal assessment. For product-specific implementation information, consult the CookiePilot documentation.

1. Inventory existing tags

List analytics, advertising, personalization and embedded-content tags, including scripts added outside GTM. Record their triggers and identify the consent category that applies to each one.

Load the CMP early enough to establish the initial consent state before analytics or advertising tags execute. Confirm the order in a clean browser session instead of relying only on the GTM workspace configuration.

Set appropriate defaults for the relevant Consent Mode parameters. In implementations that require prior permission for optional storage, these parameters commonly begin in a denied state and change only after the CMP reports the visitor’s choice.

The correct configuration depends on the implementation model and applicable requirements. Verify it against Google’s current guidance and qualified legal advice.

Document how each CMP category affects:

  • analytics_storage
  • ad_storage
  • ad_user_data
  • ad_personalization

Do not assume that one general “accept” value covers every choice. Partial consent must also produce a consistent state.

5. Review tags and triggers

Separate necessary tags from analytics, advertising and other optional tags. Check built-in consent settings alongside custom triggers, templates and Custom HTML tags. Review third-party pixels placed directly in the site code separately.

When a visitor saves or changes their preferences, the CMP should pass the updated state to the tag implementation. Confirm that tags respond to the new selection without relying on stale values.

7. Document ownership

Record the category mapping, trigger rules, test cases and the person or team responsible for future GTM changes. This makes consent checks part of the publishing process rather than a one-time task.

Use GTM Preview, Google Tag Assistant, browser developer tools and a clean browser profile. Test each path from a fresh session.

TestExpected resultWhere to check
Reject optional categoriesApplicable consent signals remain denied, and optional tags follow the configured restrictionsGTM Preview, Tag Assistant and network requests
Allow analytics onlyAnalytics and advertising states reflect the different choicesConsent state, GA4 debugging and network requests
Accept all categoriesRelevant states update, and eligible tags can runTag Assistant and tag diagnostics
Change preferencesThe new state is applied consistentlyCMP preference interface, browser storage and network requests
Add a campaign tagThe tag is reviewed for consent requirements before publicationGTM workspace and preview environment

A request appearing in the network panel does not, by itself, explain how a tag behaved. Review its consent state, request parameters and the documented configuration for the selected Consent Mode implementation.

  • Loading analytics or advertising tags before the initial consent state. Check the load order in a new browser session.
  • Mapping every CMP category to the same Google signals. Test partial consent as well as “reject all” and “accept all.”
  • Treating Consent Mode as legal consent. It carries consent signals but does not collect informed choices by itself.
  • Ignoring scripts outside GTM. Plugins, embedded media and directly installed pixels may follow separate loading rules.
  • Using Custom HTML without reviewing consent behavior. Confirm what each script loads and under which conditions.
  • Testing only the banner interface. Verify the resulting consent state, tag execution and network activity.
  • Publishing tags without assigning an owner. Include consent checks in the GTM review process.

Consent Mode v2 helps supported Google services adjust their behavior according to the signals they receive. It does not guarantee compliance with the GDPR, UK GDPR, ePrivacy rules or other applicable requirements.

Whether a technology requires consent—and how choices should be presented and recorded—depends on the site, its tools, its audience and the relevant jurisdiction. Consult current regulator guidance and qualified legal advice when establishing those requirements. For a broader introduction, see the GDPR cookie banner guide.

Frequently asked questions

No. Consent Mode communicates consent states to supported Google services. A CMP or another suitable mechanism may still be needed when a site must request, manage or record visitor choices.

A GTM implementation commonly needs to account for ad_storage, analytics_storage, ad_user_data and ad_personalization. Their mapping should match the CMP categories and the site’s documented requirements.

Can GTM load before the visitor chooses?

The GTM container can load before a choice is made, but the tags it controls should behave according to the initial consent state and the selected implementation model. Test this behavior instead of inferring it from the container’s presence.

When should the setup be retested?

Retest after changes to tags, triggers, CMP configuration, website templates, ecommerce plugins or directly embedded scripts. A regression test should cover rejection, partial consent, full consent and preference changes.

Next step

Start with a complete tag inventory, document the CMP-to-GTM mapping and test every consent path in a clean browser. If you are evaluating a CMP for this workflow, review CookiePilot’s stated consent management features and confirm that they fit your technical requirements.

Written by

Marcin

Zespół CookiePilot dzieli się wiedzą o RODO, PKE i zarządzaniu cookies.

Share this article: