Google Tag Manager initial setup (outdated)

This article is outdated and showing legacy way of implementing CookieHub to Google Tag Manager.

Please use our latest instructions instead to avoid issues:

Google Tag Manager Implementation

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

4. Click  Import Container in the  Container section

5. Download the  CookieHub GTM recipe

6. Select the CookieHub GTM recipe as the  container file, select your  workspace and select  Merge in import option.

Please note! Make sure you select Merge in the import option to avoid removing your current tags and triggers.

7. Once you have done everything from step 6 you will get an overview of added and modified tags. Click the  Confirm button to complete the import.

 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.

9. Click the  CookieHub tag and the edit window will be shown:

10. Replace the xxxxxxxx with your CookieHub Domain Code available in the CookieHub as shown below:

11. Now you’ll only have to save your tag and CookieHub is ready to use in your GTM workspace. We have included two different sample tags to show how the triggers should be configured.

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.

Still need help? Contact Us Contact Us