Using the Cookie Banner with Tag Manager
Using the Cookie Banner with Google Tag Manager
If you‘re already using Google Tag Manager, our banner can be easily integrated with it. The only thing you need to do is connect Tag Manager to Data Driven Tool. If it‘s already connected, you can use the package for Tag Manager under the Google tab.
This installs all the necessary triggers and variables.
Variables:
3 variables are added for reading cookies. One for each category.
- ddt_analytics
- ddt_marketing
- ddt_social
3 variables are added for events. This is done so that the decisions can be determined directly, not only when the page is viewed twice.
- ddt-analytics DataLayer
- ddt-marketing DataLayer
- ddt-social DataLayer
Trigger:
The variables are linked directly to the triggers that are created.
We get 6 triggers. 3 to prevent the tags from being triggered if there is no user consent. These are called:
- ddt_analytics
- ddt_marketing
- ddt_social
We now have to add these to the respective tags as exceptions. With Google Analytics we would then add the trigger ddt_analytics. See the following picture.
After you have added the exceptions to the tags, you may add the triggers for the user decisions.
The triggers for activation are as follows:
- consent analytics
- consent marketing
- consent social
You add this every day with the trigger Page view, Home is ready or the window has loaded.
For example, adding this trigger to a tag used to detect clicks would call out a false event.
Using the example of Analytics for the page view, it would look like this:
If you have done this with each day of the proper category, you are welcome to test Tag Manager in the preview and publish it after.
If you want to know how the banner ends up on the page, read the following article:
https://datadriventool.com/en/blog/using-the-cookie-content-banner-without-tag-manager/
You can follow this article and paste the code for the banner into thepart of your website. This is best done right at the beginning. If you load marketing and analysis scripts outside of Tag Manager, read the functions section as well. Otherwise, just ignore this part.