consent mode v2

what is consent mode v2 what are the steps to install and working to know

Consent Mode v2 is a feature by Google that allows websites to adjust how Google tags behave based on the user’s consent status. It helps websites comply with data protection regulations like GDPR and CCPA by respecting users’ privacy choices while still enabling valuable insights for website owners.

Key Features of Consent Mode v2

  1. Granular Control: Allows more precise control over different types of data (e.g., ad storage, analytics storage).
  2. Consent Signals: Integrates with popular Consent Management Platforms (CMPs) to determine consent status.
  3. Tag Behavior Adjustment: Adjusts the behavior of Google tags based on the consent status, ensuring compliance.
  4. Conversion Measurement: Enhances conversion measurement capabilities while respecting user consent preferences.
Consent mode v2
Steps to Install Consent Mode v2
  • Implement a Consent Management Platform (CMP): Choose and implement a CMP on your website to gather user consent for data usage.
  • Update Your Website’s Tagging Setup: Modify your existing Google tags to work with Consent Mode. This involves updating the global site tag (gtag.js) or Google Tag Manager (GTM) setup.
  • Configure Consent Mode: Add the Consent Mode configuration to your global site tag or Google Tag Manager container. This includes specifying default consent settings and integrating with your CMP to dynamically adjust based on user consent.
Example: Configuring Consent Mode with gtag.js

“`html

<script async src=”https://www.googletagmanager.com/gtag/js?id=YOUR_GA_MEASUREMENT_ID”></script>

<script>

// Initialize gtag

window.dataLayer = window.dataLayer || [];

function gtag(){dataLayer.push(arguments);}

gtag(‘consent’, ‘default’, {

‘ad_storage’: ‘denied’,

‘analytics_storage’: ‘denied’

});

gtag(‘js’, new Date());

gtag(‘config’, ‘YOUR_GA_MEASUREMENT_ID’);

</script>

“`

Example: Configuring Consent Mode with Google Tag Manager

  • Set up a Tag Manager Container: Create or open your existing GTM container.
  • Add Consent Initialization Tag: Go to Tags > New > Tag Configuration > Consent Initialization.
    • Configure the default consent settings like the gtag.js example above.
    • Add Consent Mode Integration with CMP.
    • Create a custom HTML tag that listens for changes in the consent status from your CMP and updates Consent Mode accordingly.

Example: Custom HTML Tag in GTM for CMP Integration.

“`html

<script>

window.addEventListener(‘consent_changed’, function(event) {

gtag(‘consent’, ‘update’, {

‘ad_storage’: event.detail.ad_storage,

‘analytics_storage’: event.detail.analytics_storage

});

});

</script>

“`

Steps to Verify Working

  1. Check Network Requests: Use browser developer tools to inspect network requests and ensure that data collection respects the consent settings.
  2. Use Google Tag Assistant: Use the Tag Assistant tool to verify that your tags are firing correctly and respecting the consent status.
  3. Monitor Analytics Data: Compare your analytics data to ensure that data collection is occurring as expected based on user consent.

By following these steps, you can implement Consent Mode v2 on your website, ensuring compliance with data protection regulations while maintaining valuable insights from your analytics tools.

Consent mode V2 setup. Difference between Basic and Advanced version

Consent Mode v2 offers two levels of setup: Basic and Advanced. Each provides different levels of control and integration capabilities to suit various website needs and compliance requirements.

Basic Consent Mode v2 Setup

Features:

  • Default Consent States: Easily set default consent states for different types of storage (e.g., ad_storage, analytics_storage).
  • Static Configuration: Basic setup usually involves a simple, static configuration without dynamic interaction with a Consent Management Platform (CMP).
Steps:
  • Add the Global Site Tag (gtag.js) or Google Tag Manager (GTM) Script:
    • Insert the gtag.js script or GTM container script into your website’s `<head>` section.
  • Set Default Consent States: Configure the default consent states for ad_storage and analytics_storage.
  • Minimal Integration: No dynamic updates based on user interaction are configured in this basic setup.

Example: Using gtag.js:

“`html

<script async src=”https://www.googletagmanager.com/gtag/js?id=YOUR_GA_MEASUREMENT_ID”></script>

<script>

window.dataLayer = window.dataLayer || [];

function gtag(){dataLayer.push(arguments);}

gtag(‘consent’, ‘default’, {

‘ad_storage’: ‘denied’,

‘analytics_storage’: ‘denied’

});

gtag(‘js’, new Date());

gtag(‘config’, ‘YOUR_GA_MEASUREMENT_ID’);

</script>

“`

Example Using Google Tag Manager:

  1. Set up a GTM Container: Create a new tag in GTM for consent initialization.
  2. Add Consent Initialization Tag: Go to Tags > New > Tag Configuration > Consent Initialization.
    • Set default consent values for ad_storage and analytics_storage.

Advanced Consent Mode v2 Setup

Features:

Dynamic Consent States: Dynamically update consent states based on user interactions with a CMP.
Event Listening: Listen for consent changes and update tags in real-time.
Granular Control: More granular control over various consent signals, allowing for precise data collection based on user consent.

Steps:
  1. Integrate CMP: Choose and implement a CMP on your website to gather and manage user consent.
  2. Configure Consent Mode in GTM: Add consent initialization and dynamic consent update tags.
  3. Dynamic Consent Updates: Configure tags to listen for changes from the CMP and update consent states accordingly.

Example Using Google Tag Manager with CMP:

  • Set up CMP Integration: Implement a CMP that triggers events when consent is given or changed.
  • Create Consent Initialization Tag: In GTM, create a tag to set default consent states like the basic setup.
  • Create Custom HTML Tag for Dynamic Updates
  • “`html

<script>

window.addEventListener(‘consent_changed’, function(event) {

gtag(‘consent’, ‘update’, {

‘ad_storage’: event.detail.ad_storage,

‘analytics_storage’: event.detail.analytics_storage

});

});

</script>

“`

  • Create Triggers for Custom HTML Tag: Set up triggers in GTM to listen for consent changes from the CMP and execute the custom HTML tag.

Differences Between Basic and Advanced Versions

  • Configuration Complexity:
    1. Basic: Simple, static configuration with default consent states.
    2. Advanced: Complex, dynamic configuration with real-time updates from CMP.
  • Integration with CMP:
  1. Basic: No direct integration with CMP, relies on static settings.
  2. Advanced: Direct integration with CMP, allows real-time consent state updates
  • Control Level:
    1. Basic: Basic control over consent states, suitable for simple compliance needs.
    2. Advanced: Granular control over consent states, suitable for detailed compliance and advanced data handling.
  • User Interaction Handling:
    1. Basic: Does not handle user interactions dynamically.
    2. Advanced: Handles user interactions dynamically, updating consent states in real-time based on user choices.

Choosing between Basic and Advanced Consent Mode v2 depends on your website’s specific compliance requirements and the level of control needed over user consent and data collection. The Basic setup is easier and quicker to implement, while the Advanced setup provides more flexibility and compliance with complex data protection regulations

Scroll to Top