The CookieFirst consent management can be quickly implemented into Google Tag Manager (GTM) by following the steps outlined below.
- Implement the CookieFirst script in GTM
- Fire your Tags after consent is given for the appropriate category
Step 0: Requirements
For this guide we assume the following:
- You already have a Google Tag Manager account
- You already set up a container for your website
- The GTM script is embedded on your website
- You have an account at Cookie First, otherwise create on here.
Step 1: Integrate Cookie First
- Add the GTM container to your website if you didn't do that already
- Add the Cookie First embed script to your website. Learn how to do that here. Or add the code over GTM, when you do please activate "Support document.write".
Step 2: Set up data layer variables
Our integration with Tag Manager works over the DataLayar to retrieve the consent status which lets you fire your tags.
1. Go to the tab Variables and from there look at User-Defined Variables
2. Click New and call the variable Performance
3. Select Data Layer Variable and put in the field Data Layer Variable Name: cf_performance_enabled and set Default value and put in there false. Then hit Save.
4. Repeat this step for every category, so:
Optional: set Default value and put in there false
For each category we're going to set up a trigger. Go to the tab on the left called Triggers
- Click New
- Call it Opt-in Performance (for the performance category). On Trigger type choose Custom Event.
- Under Event name put in this case cf_consent_performance
- This trigger fires on Some Custom Events
- Select the variable we created Performance and then equals and fill in true
- Repeat this step for every Variable we created in the previous step. Use the event names below for the categories.
Step 4: Customise your Tags
In this part we will set up Google Analytics in the performance category. Remember to set the analytics also to anonymizeIP.
1. Open the tag. Or add it if you haven't done that already.
2. Under Triggering choose your predefined Trigger. In this case Opt-in Performance.
3. Because we already set the default value of the variable to false we do not need to set any exceptions.
4. Save the tag and repeat this step for every tag assigning it to the right Trigger and category.
Disclaimer: CookieFirst cannot be held liable for misconfigurations of our banner, you are solely responsible of setting it up in a correct way which complies to the GDPR