Block Tags with Google Tag Manager
Trigger tags based on user consent with Google Consent Mode v2.
Step 1: Enable Google Consent Mode
Navigate to “Integrations” from the sidebar and enable the Google Consent Mode integration.
Step 2: Setup Cookie Categories
GTM supports 7 different default consent types. CookieChimp maps these Google consent types into the following categories:
CookieChimp Category ID | Google Consent Type |
---|---|
essential | functionality_storage, security_storage |
marketing | ad_storage, ad_user_data, ad_personalization |
analytics | analytics_storage |
personalization | personalization_storage |
These categories are setup by default. When a user opts-in to a consent category or a Google service in the category is consented to, the linked Google consent type will change from ‘denied’ to ‘granted’ and vice versa.
Apart from the default 7 consent types, we will also send the consent state of your services to Google.
e.g. When a user consents to a service named “Hotjar”, the consent for this service is updated as ‘granted’.
Step 3: Set up Google Tag
-
Sign in to your Google Tag Manager account and add a new tag.
-
Choose the type of tag you want to create.
-
Add any additional consent checks for the tag to fire.
Navigate to “Advanced Settings” > “Consent Settings”. Check the “Require additional consent for tag to fire” button and add any additional consent checks from the dropdown of options. This can be a service name as added on the platform.
-
Add a custom trigger.
This is required to listen for changes in consent state. This event will be triggered by CookieChimp on page load and when the user changes their consent settings.
Choose “Custom Event”
Set up the custom trigger with event name
cookiechimp_consent_update
and save the tag.
This tag is now set up and will only fire when the required consent is granted.