Legal Monster supports Google Tag Manager, which is an easy way to integrate your cookie consents. This guide shows you how to block cookies with Google Tag Manager.
When using Legal Monster with Google Tag Manager, you can easily block out external cookies when users have not given consent and activate the cookies again when the user has given consent. If you do not block cookies, based on your users consent, your solution is not compliant.
This guide will show you how to get started blocking your cookies.
What cookies do I use?
Good question! It can be very difficult to get an overview over, which cookies you use on your site. Legal monster automatically scan your site, and tells you what cookies you use. To see the cookies, that Legal Monster has found on your site navigate to 'Cookies' from the side menu in the dashboard.
How do I set cookies using Google Tag Manager?
There are different ways to set cookies on your site. If you use wordpress, squarespace or similar you might have installed plugins, which can set cookies. You might also have added custom code often by copy-and-pasting a <script>-code block into your source code.
To use Google Tag Manager, you must instead copy this custom code into a Google Tag. Google Tag Manager already has some predefined implementation, where you only need to setup the tag in Google Tag Manager, without any code. Google Tag Manager also supports custom code, if you do not find your scripts or script provider in the predefined list. You can read more about what tags are, and how to use them with Google Tag Manager in Google's own help center.
Once you cookies and scripts are set up in Google Tag Manager, you must remove the </script> from the source code of your website, and only keep the Google Tag manager code.
Before you start:
Before following these steps, please be sure that you have:
As mentioned previously, you must have consent for your users before you can set your cookies. Legal Monster will handle all of this for you, if you integrate with Google Tag Manager. In Google Tag Manager, you need to create triggers for when to set which cookies.
First you must create a custom trigger in Google Tag Manager. Triggers define how and when to run a certain script/tag - cookies. Click on "Triggers" in the side panel and click on "New".
You need to assign triggers to both your analytics and marketing tags. There is no need to add any triggers for when analytics or marketing consent is rejected, because our widget handles this internally. We only trigger your tags when the user has consented to a given category.
Click on editing pen icon and select Custom Event as trigger type from the side panel menu.
Hereafter, you're asked to provide an event for your trigger. With Legal monster you have two event names:
This event is fired when a user gives consent to analytical cookies, and on every page-load when the user has already given consent to analytical cookies.
This event is fired when a user gives consent to marketing cookies, and on every page-load when the user has already given consent to marketing cookies.
A trigger for the marketing cookies
Save your trigger. Remember, you must create a trigger for marketing cookies and another trigger for analytics cookies.
For your marketing trigger, you must use the legalmonster.cookie.marketing.accepted event name and for analytics you must use the legalmonster.cookie.analytics.accepted event name.
Step 2: Configure your tags
You now need to edit your tags, so they are triggered by your newly created trigger. Go through each of your tags. Once you've selected a tag, you must associate it with the appropriate trigger, i.e. analytics trigger for analytical cookies and marketing trigger for marketing cookies.
Editing the tag for HubSpot and assigning it the trigger "Accepted analytical cookies"
Available tags if you created the Legal Monster triggers as described in step 1
Lastly, in the bottom of the Tag Configuration window, you'll see a checkbox for "Enable overriding settings in this tag", which you must check.
Example - Google Analytics
For example, this guide shows you how to setup Google Analytics tag with the appropriate trigger.
From the trigger type overview select "Google Analytics - Universal" and from track type select "Event".
In the bottom of the Tag Configuration window, you'll see a checkbox for "Enable overriding settings in this tag", which you must check. Fill out the "Tracking Id" text field with your Google Analytics tracking Id.
Congratulations on completing your first step towards collecting compliant cookie consent. Pat your self on the back and know that our privacy mascot Sven is proud of you.