\n```\n\nThen GTM loads.\n\n---\n\n## 4) Update consent when the user makes a choice\nWhen the user accepts or rejects categories in the CMP, push an update to GTM.\n\nExample:\n\n```html\n\n```\n\nIf the user declines, keep them denied.\n\n---\n\n## 5) Map CMP categories to GTM consent types\nTypical mapping:\n\n- **Necessary** → always allowed, no update needed\n- **Analytics** → `analytics_storage`\n- **Marketing/Advertising** → `ad_storage`, `ad_user_data`, `ad_personalization`\n- **Functional** → depends on your setup\n- **Preferences** → depends on your setup\n\nIf your CMP supports a built-in GTM or Google Consent Mode integration, use that rather than building it manually.\n\n---\n\n## 6) Configure GTM triggers and tags\nInside GTM:\n\n- Set Google tags to respect consent\n- Use consent checks on triggers where needed\n- Ensure tags that require consent are blocked until consent is granted\n\nFor Google tags, many templates already support consent mode automatically.\n\n---\n\n## 7) Test it\nUse:\n\n- **GTM Preview mode**\n- **Chrome DevTools**\n- **Google Tag Assistant**\n- Your CMP’s test environment\n\nCheck that:\n- default consent is denied\n- tags don’t fire before consent\n- tags fire after consent is granted\n- consent updates are passed correctly\n\n---\n\n## If your CMP has a native GTM integration\nMany CMPs offer:\n- a GTM template\n- a consent API\n- a direct Google Consent Mode integration\n\nIn that case:\n1. Install the CMP template in GTM or the CMP script on site\n2. Enable Google Consent Mode in the CMP dashboard\n3. Map consent categories\n4. Publish and test\n\n---\n\n## Common pitfalls\n- GTM loads before the CMP\n- Consent defaults are not set early enough\n- CMP categories don’t match GTM consent types\n- Tags are hardcoded outside GTM and ignore consent\n- Consent is not updated on user action\n- Older tag setups still rely on deprecated cookie behavior\n\n---\n\nIf you tell me **which CMP you’re using** (OneTrust, Cookiebot, Didomi, Complianz, Usercentrics, etc.) and whether you’re using **Google Consent Mode v2**, I can give you the exact setup steps and code."}}}

Prompt

How do I connect a CMP to Google Tag Manager?

Technology / Marketing Automation1 observationLast seen Oct 29, 2026

Latest observation

Oct 29, 2026OpenAI APIWeb search: off

To connect a CMP (Consent Management Platform) to Google Tag Manager (GTM), the usual goal is to make your CMP send consent choices to GTM so tags only fire when allowed.

Here’s the standard setup:

1) Decide which consent framework you’re using

Most CMPs integrate with one of these:

  • Google Consent Mode v2 — recommended for Google products
  • IAB TCF v2.2 — common for ad/marketing consent in Europe
  • A custom consent signal pushed to GTM via dataLayer

If you use Google Ads, GA4, or Floodlight, Consent Mode v2 is usually the right approach.


2) Load the CMP before GTM

Your CMP script should load early, ideally in the <head> before the GTM container snippet, so it can set default consent before tags fire.

Example order:

  1. CMP script
  2. GTM script

3) Set a default consent state

Before a user chooses, GTM should start with denied or restricted consent.

Example using dataLayer:

<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}

  gtag('consent', 'default', {
    ad_storage: 'denied',
    analytics_storage: 'denied',
    ad_user_data: 'denied',
    ad_personalization: 'denied',
    wait_for_update: 500
  });
</script>

Then GTM loads.


4) Update consent when the user makes a choice

When the user accepts or rejects categories in the CMP, push an update to GTM.

Example:

<script>
  gtag('consent', 'update', {
    ad_storage: 'granted',
    analytics_storage: 'granted',
    ad_user_data: 'granted',
    ad_personalization: 'granted'
  });
</script>

If the user declines, keep them denied.


5) Map CMP categories to GTM consent types

Typical mapping:

  • Necessary → always allowed, no update needed
  • Analytics → analytics_storage
  • Marketing/Advertising → ad_storage, ad_user_data, ad_personalization
  • Functional → depends on your setup
  • Preferences → depends on your setup

If your CMP supports a built-in GTM or Google Consent Mode integration, use that rather than building it manually.


6) Configure GTM triggers and tags

Inside GTM:

  • Set Google tags to respect consent
  • Use consent checks on triggers where needed
  • Ensure tags that require consent are blocked until consent is granted

For Google tags, many templates already support consent mode automatically.


7) Test it

Use:

  • GTM Preview mode
  • Chrome DevTools
  • Google Tag Assistant
  • Your CMP’s test environment

Check that:

  • default consent is denied
  • tags don’t fire before consent
  • tags fire after consent is granted
  • consent updates are passed correctly

If your CMP has a native GTM integration

Many CMPs offer:

  • a GTM template
  • a consent API
  • a direct Google Consent Mode integration

In that case:

  1. Install the CMP template in GTM or the CMP script on site
  2. Enable Google Consent Mode in the CMP dashboard
  3. Map consent categories
  4. Publish and test

Common pitfalls

  • GTM loads before the CMP
  • Consent defaults are not set early enough
  • CMP categories don’t match GTM consent types
  • Tags are hardcoded outside GTM and ignore consent
  • Consent is not updated on user action
  • Older tag setups still rely on deprecated cookie behavior

If you tell me which CMP you’re using (OneTrust, Cookiebot, Didomi, Complianz, Usercentrics, etc.) and whether you’re using Google Consent Mode v2, I can give you the exact setup steps and code.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.