GA4 & GTM Template


For sites that use Google Analytics 4 and Google Tag Manager, Cookie Control can be integrated with Google Consent Mode v2 with minimum or no code using our GTM Template.

If you would prefer to manually integrate Cookie Control with Google Consent Mode v2 for easier customisation opportunities, please see our Guide on Optional Categories where it is used as the main example.

Anchor point for Add the Cookie Control Consent Template to Google Tag Manager Add the Cookie Control Consent Template to Google Tag Manager

  1. 1. Download our GTM Consent template.
  2. 2. Within GTM open your container.
  3. 3. From the left hand menu, select 'Templates'.
  4. 4. From the 'Tag Templates' panel, select 'New'.
  5. 5. Press the three dots icon in the top right corner and select 'Import' from the dropdown menu.
  6. 6. Select the template.tpl file you downloaded in step 1.
  7. 7. Select 'Save'.
Please note, Community licence users cannot test the template within Google Tag Manager.

Anchor point for Integrate Cookie Control with Google Tag Manager on your website Integrate Cookie Control with Google Tag Manager on your website

  1. 1. Within GTM open your container.
  2. 2. From the left hand menu, select 'Tags'.
  3. 3. From the 'Tags' panel, select 'New'.
  4. 4. From the 'Tags Configuration' panel, select the edit icon.
  5. 5. Select the 'Cookie Control Template' tag which will be listed under 'Custom'.
  6. 6. Enter your Cookie Control apiKey and select the relevant product from your Cookie Control subscription.
  7. 7. Select your default consent mode settings ('granted' or 'denied') for Analytical and Marketing cookies.
  8. 7. Select your default consent mode settings ('granted' or 'denied') for each consent type.
  9. 8. From the 'Triggering' panel, select the 'Consent Initialization - All Pages' option.
  10. 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.