Info
Content

Working with GTM + Google Consent Mode v2

The Google Tag Manager offers an integration of the Google Consent Mode v2 signals that can be used to trigger events, e.g. the tracking of pageviews through Google Analytics. The Google Consent Mode differentiates between two modes: Basic Implementation and Advanced Implementation.

The Basic Implementation is the way in which the Google Analytics Tags or Google Ads Tags are not fired if no consent is given. This is usually also called "hard blocking". The advantage here is a higher legal safety. The downside is a less accurate tracking (for users that did not give consent).

In order to implement the Basic Implementation of either Google Analytics or Google Ads via GTM please follow these steps:

  1. Install the consentmanager CMP Code in your website (either direct as automatic blocking code, semi-automatic block code or indirect via GTM template).
  2. Enable Google Consent Mode in the CMP settings
  3. Enable Google Consent Mode in your GTM account
  4. In GTM, create variables as needed: In GTM go to Variables > New and click on configure:



  5. Choose variable type Page Variables > Data Layer Variable, set the Variable Name to cmpConsentVendors:

  6. Go to Triggers > New and click on configure:



  7. Use event Name cmpEvent and one custom events to it:

     

  8. For each event at least one rule is necessary, for Google Analytics tags use: cmpConsentVendors contains ,s26, (include the comma in the rule). For Google Ads (AdWords tracking, remarketing, ...) use cmpConsentVendors contains ,s1, OR cmpConsentVendors contains ,s1498, (include the comma in the rule, use vendor ID depending on the vendors you use in your vendor list)

  9. Go to Tags > Edit > Triggers and assign the trigger to the tag:
    (Ensure to remove system events such as pageview and only use the cmpEvent)




    Important: Ensure that the trigger is the only trigger for each tag you are using. Do not combine triggers with other triggers/events like "All pages" or "On page load" and so on.

The Advanced Implementation is the way in which the Google Analytics Tags or Google Ads Tags are fired even if no consent is given. In this case the Consent Mode signals are used to tell Google Analytics or Google Ads to limit the tracking. This is usually also called "soft blocking". The advantage here is a higher accuracy in tracking. The downside is a lower legal safety.

In order to implement the Advanced Implementation of either Google Analytics or Google Ads via GTM please follow these steps:

  1. Install the consentmanager CMP Code in your website (either direct as automatic blocking code, semi-automatic block code or indirect via GTM template).
  2. Enable Google Consent Mode in the CMP settings
  3. Enable Google Consent Mode in your GTM account
  4. In GTM, create variables as needed: In GTM go to Variables > New and click on configure:



  5. Choose variable type Page Variables > Data Layer Variable, set the Variable Name to userChoiceType:



  6. Go to Triggers > New and click on configure:



  7. Use event Name cmpEvent and one custom events to it:

     

     

  8. For each event at least one rule is necessary: userChoiceType RegEx "useraction|loaded|automatic"



  9. Go to Tags > Edit > Triggers and assign the trigger to the tag:
    (Ensure to remove system events such as pageview and only use the cmpEvent)




    Important: Ensure that the trigger is the only trigger for each tag you are using. Do not combine triggers with other triggers/events like "All pages" or "On page load" and so on.

How to handle events that are triggered based on user action?

For events that are triggered based on user action (e.g. add to basked) we recommend:

Basic Implementation: Use your existing trigger (the add-to-basked event) and add a condition for the specific vendor, e.g. cmpConsentVendors contains ,s26, . Ensure that this trigger is alway fired after consent is given.

Advanced Implementation: No adjustment to triggers is necessary.

GTM also offers the possibility to work with Consent Mode in order to protect tags from triggering. In order to use this feature you can use our GTM Template and or you can manually implement the CMP into the page or the tag manager.

Please note that the Consent Mode feature for GTM is ONLY a visual help and will not perform any actual blocking.

In order to enable the Consent Mode in GTM please follow these steps:

  1. Login to your account and click on Admin > Container Settings

  2. Check the box "Enable consent overview" and press Save

  3. Once enabled, you will find a shield icon under Tags which will show you which Consent Mode settings are applied to which tag:



 

Back to top