Google’s Consent Mode allows you to tailor how tags behave based on a user’s consent status for different tracking purposes. While primarily designed for use with Google tags, when used with Google Tag Manager (GTM), it can also help control third-party tags through Consent Mode’s APIs and custom logic.

There are two main types of Consent Mode:


Why Basic Consent Mode Is Challenging

Unlike Advanced Consent Mode, BCM requires a hands-on approach. Tags must be manually configured to remain dormant until the relevant consent is granted. This adds complexity, especially when dealing with asynchronous Consent Management Platforms (CMPs) or non-cooperative tools.

This guide will walk you through:

  1. Implementing Consent Mode (manually, with a CMP, or a hybrid approach).
  2. Configuring your tags in GTM to respect consent conditions….

Though the emphasis is on GTM, users of the standalone Google Tag can also benefit from many of the principles shared here.


What Is Basic Consent Mode?

BCM is not a specific feature—it’s an implementation pattern. It enforces that tags requiring consent must only trigger after consent is explicitly granted.

This aligns with data protection laws like GDPR and ePrivacy, which already demand such behavior. However, to enforce it with Consent Mode, your CMP must be integrated with Google’s Consent Mode API—or you’ll need to bridge that gap manually.


Consent Mode Calls: Default and Update

There are two key API calls in Consent Mode:

Example – Default Call:

js

{

  ad_storage: “denied”,

  analytics_storage: “denied”,

  ad_user_data: “denied”,

  ad_personalization: “denied”

}

Example – Update Call:

js

{

  ad_storage: “denied”,

  analytics_storage: “granted”,

  ad_user_data: “denied”,

  ad_personalization: “denied”

}


The Ideal Setup

Step 1: Default Call

Always fire a tag using the Consent Initialization – All Pages trigger. Set all consent types to “denied”.

Step 2: Update Call

If the consent status is known (e.g., from cookies), fire an Update call immediately after the Default call using the same trigger. Follow this with a dataLayer.push() containing the current consent states, e.g.:

js

window.dataLayer.push({

  event: ‘gtm_consent_update’,

  analytics_storage: ‘granted’,

  ad_storage: ‘denied’,

});

Step 3: User Interaction

When a user updates their consent choices, fire another Update call and push a new gtm_consent_update event.


Working with CMPs

While some CMPs offer dedicated GTM templates, many don’t support Consent Mode well or rely on asynchronous loading—leading to unpredictable tag behavior.

Best Practices:

Example: Cookiebanners.nl is a CMP that provides a GTM template integrating both Consent Mode and dataLayer events properly.


Manual Implementation with GTM Custom Templates

  1. Default Consent Tag
    • Trigger: Consent Initialization – All Pages
    • Set all states to “denied”
    • Tag priority: 10
  2. Update Consent Tag
    • Same trigger
    • Only fire if user consent is already known (read from cookies/localStorage)
    • Set relevant states to “granted”
    • Enable dataLayer.push() to trigger consent-based tags
  3. Handling User Consent Changes
    • When the user updates their settings, have the CMP push a gtm_consent_update event.
    • Fire the Update tag again to reflect the new consent states.

Configuring Tags for Basic Consent Mode

Dealing with GTM’s “Once per page” Bug

Tags with “Once per page” enabled may not fire again after being blocked once. GTM mistakenly treats them as having already fired, even if blocked.

Fix: Control firing only through triggers, not Additional Consent Checks, for such tags.


Example Configurations

Initialization Tags (Fire Once per Page)

Use a trigger based on gtm_consent_update and relevant Data Layer variables like {{DLV – analytics_storage}} set to “granted”.

Tags that Fire Multiple Times

Set the trigger to fire on:

Tags That Fire Under Specific Conditions

Use a Trigger Group that includes:

This ensures tags like GA4 Purchase fire only when both conditions are met.


Edge Cases & Considerations


Final Thoughts

Setting up Basic Consent Mode is complex and often frustrating. The key challenge is ensuring that tags wait for consent while maintaining performance and data integrity.

While many CMPs are not optimized for this task, using GTM custom templates gives you full control. Ideally, the CMP should only inform GTM of the user’s choices. Let GTM handle the Consent Mode logic using stored values and dataLayer events.

A clean and proactive setup makes adapting tags to consent straightforward. But if you’re stuck with a limited CMP, you’ll need to get creative with triggers and variables.

Need help with a tricky use case or edge case? Drop a comment and share your situation—we’re here to help.

For more information, please follow this guide.

Leave a Reply

Your email address will not be published. Required fields are marked *