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:
| Layer | Responsibility | Practical consideration |
|---|---|---|
| CMP | Collects and records visitor choices | Use the CMP as the source of the consent state |
| Website | Loads the CMP and initializes consent | Establish the default state before optional tags run |
| GTM | Controls tag execution | Configure tags and triggers to respect consent choices |
| Google tags | Receive Consent Mode signals | Handle ad_storage, analytics_storage, ad_user_data and ad_personalization as configured |
| QA process | Verifies the implementation | Test 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.
Google Consent Mode v2 setup checklist for GTM
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.
2. Initialize consent before optional tags run
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.
3. Configure the default consent state
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.
4. Map CMP categories to Google consent parameters
Document how each CMP category affects:
analytics_storagead_storagead_user_dataad_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.
6. Apply consent updates
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.
How to test consent states in GTM
Use GTM Preview, Google Tag Assistant, browser developer tools and a clean browser profile. Test each path from a fresh session.
| Test | Expected result | Where to check |
|---|---|---|
| Reject optional categories | Applicable consent signals remain denied, and optional tags follow the configured restrictions | GTM Preview, Tag Assistant and network requests |
| Allow analytics only | Analytics and advertising states reflect the different choices | Consent state, GA4 debugging and network requests |
| Accept all categories | Relevant states update, and eligible tags can run | Tag Assistant and tag diagnostics |
| Change preferences | The new state is applied consistently | CMP preference interface, browser storage and network requests |
| Add a campaign tag | The tag is reviewed for consent requirements before publication | GTM 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.
Common GTM consent mistakes
- 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.
Legal and implementation context
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
Does Consent Mode v2 replace a cookie banner?
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.
Which Consent Mode v2 parameters should I check?
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.
