GA4 & GTM Template
This guide is for users implementing Cookie Control using a simple Google Tag Manager Consent Mode implementation. For more complex implementations using GTM Consent Mode, please take a look at our Google Analytics 4 Consent mode guide. If you are not using GTM Consent Mode, please take a look at our Getting Started section instead.
Anchor point for GA4 & GTM Consent Mode Template GA4 & GTM Consent Mode Template
For sites that use Google Analytics 4 and Google Tag Manager, Cookie Control can be integrated with Google Consent Mode with minimum or no code.
Anchor point for Add the Cookie Control Consent Template to Google Tag Manager Add the Cookie Control Consent Template to Google Tag Manager
- 1. Download our GTM Consent template.
- 2. Within GTM open your container.
- 3. From the left hand menu, select 'Templates'.
- 4. From the 'Tag Templates' panel, select 'New'.
- 5. Press the three dots icon in the top right corner and select 'Import' from the dropdown menu.
- 6. Select the template.tpl file you downloaded in step 1.
- 7. Select 'Save'.
Please note, If your aim is to implement with Google Analytics 4, then you will need to add the relevant cookies to the template to protect them. These cookies can be added as an array under the "cookies" property of the analytics optional cookies category. Alternatively, please use this GA4 GTM Consent template instead with the cookies already added.
Anchor point for Integrate Cookie Control with Google Tag Manager on your website Integrate Cookie Control with Google Tag Manager on your website
- 1. Within GTM open your container.
- 2. From the left hand menu, select 'Tags'.
- 3. From the 'Tags' panel, select 'New'.
- 4. From the 'Tags Configuration' panel, select the edit icon.
- 5. Select the 'Cookie Control Template' tag which will be listed under 'Custom'.
- 6. Enter your Cookie Control apiKey and select the relevant product from your Cookie Control subscription.
- 7. Select your default consent mode settings ('granted' or 'denied') for Analytical and Marketing cookies.
- 8. From the 'Triggering' panel, select the 'Consent Initialization - All Pages' option.
- 9. Select 'Save'.
Please note, if you require a listener function to execute when the state of the specified consent type changes. Please use Google's addConsentListener API.