About Google Consent mode
Google Consent mode allows you to adjust how your Google tags behave, based on the consent status of your users. You can indicate that consent hasn't been granted yet for analytics and ads cookies prior consent. Google's tags will dynamically adapt, only utilizing cookies after consent has been given by the user.
You can read more about Google Consent mode in Google's support article.
Currently the following Google products support Consent mode:
Implementing Consent mode
To greatly simplify implementation, and to ensure that scripts load in the correct order, and using the correct settings, you can now add Google Tag Manager with Consent mode enabled using the Cookiebot WordPress plugin.
First things first:
- Make sure you have version 3.9 (or newer) of the Cookiebot WordPress plugin
- Make sure you've already created a Google Tag Manager account, and have a container ID, formatted as "GTM-XXXXXX"
- Figure out if you need to rename Google Tag Manager's dataLayer. If you don't know what that means, you can probably just use the default "dataLayer"
- Avoid implementing Cookiebot twice, by ensuring that you don't load Cookiebot using the Cookiebot CMP tag in Google Tag Manager.
If you're unsure:
- click the Tags menu item in Google Tag Manager
- Check if Cookiebot CMP is listed
- If it is, ensure that there is nothing under Firing Triggers.
- Remove the tag or its trigger to ensure it won't load.
- Remember to publish your changes if you made any.
Click on the Cookiebot menu item in the menu on left-hand side, and select Google Tag Manager, or navigate directly to the Google Tag Manager dialog screen using this link: MYDOMAIN.COM/wp-admin/admin.php?page=cookiebot_GTM
You should see the following screen:
To add Google Tag Manager, check the box labelled Enable GTM and enter your container ID in the text field labelled GTM ID.
If you need to use a different name for your dataLayer than the default "dataLayer", you can specify this in the text field labelled DataLayer name. This will then automatically be applied to Cookiebot, Google Tag Manager, and the Consent mode snippet.
You can leave the value unchanged if you don't need to rename the dataLayer.
Lastly, to enable Google Consent mode, check the box labelled Google Consent Mode.
Click the Save button to save your settings.
You can now safely use the All pages trigger for the tags mentioned above, without needing to add Cookiebot triggers or conditions to prevent cookies from being set prior consent.
Please note that you still need to use Cookiebot triggers and/or conditions for tags that don't support Google Consent mode as descried here: https://support.cookiebot.com/hc/en-us/articles/360003793854-Google-Tag-Manager-deployment#controlling.
TCF 2.0 enabled:
If you've enabled both Google Tag Manager and the IAB framework using the Cookiebot WordPress plugin, the following line of code will be added above the Google Tag Manager snippet on all pages:
This will enable TCF support in Google Tag Manager, further ensuring that your visitors' consent preferences are honored.