Google Tag Manager initial setup
You can easily integrate CookieHub with Google Tag Manager (GTM) and use the provided triggers to conditionally load tags based on user consents.
CookieHub will automatically push events and variables to the dataLayer when a cookie category is allowed or denied which can be used by created triggers in GTM. You can manually create the triggers in GTM or import the provided recipe into your container. Your can find detailed information about datalayer events and variables here.
For information on how to use Consent Mode in Google Tag Manager and the CookieHub template, use the Consent Mode in Google Tag Manager article instead.
Importing the CookieHub GTM recipe
The CookieHub GTM recipe will create a tag for CookieHub v2 and triggers for all cookie categories that you can use as firing triggers.
Importing the recipe won’t change your current tags and triggers in GTM unless you are upgrading from a previous version of the CookieHub GTM implementation.
1. Login to Tag manager
2. Open the container you want to integrate CookieHub into
3. Click Admin from the top menu to enter the administration for the container
8. Now, we’ll have to add your CookieHub Domain Code to the newly inserted CookieHub tag. Click Tags in the left menu to show a list of tags in your workspace.
There are two methods to load your tags:
Only use the Allowed trigger as shown in the Sample Tag. This method will load the tag when the page is loaded and the analytics cookie category has already been allowed or if the cookie category was allowed by clicking the allow all button or using the cookie settings dialog.
The other method is shown in the Sample Tag with Exception. This method will load the tag if a category has not been allowed when another trigger is fired.
Please note that the firing trigger can’t be All Pages or other page views triggers because they are triggered before CookieHub is loaded by GTM. If you want your trigger to be All Pages, use the trigger CookieHub – Loaded instead.
12. The final step is to place the correct triggers on all your tags and you are ready to go.