Google Tag Manager

Legal Monster supports Google Tag Manager, which is an easy way to integrate your cookie consents.

In this guide...

  • You can read a brief overview of what Google Tag Manager is, and how you can use it with Legal monster.

  • If you already know Google Tag Manager is, you can skip the first part and jump directly to the integration guide.

What is Google Tag Manager?

Google Tag Manager (GTM) is a tool that organises all the third-party tags on your website (like Google Analytics or Facebook pixels), and also controls when these are triggered and set.

Tags can be statistical scripts or marketing tags that are meant for advertisement. Such tags and scripts set cookies, which collect data from your users. You must therefore collect consent before such cookies are set on your website.

The advantage of Google Tag Manager is that you can administre your tags/cookies without editing your source code or get help from a developer.

Legal Monster, if installed correctly, blocks all cookies and trackers until a user has given their consent. If you use Google Tag Manager, Legal Monster can specify which tags are set based on your user's consent settings in our cookie consent widget.

For example, if a user has not given consent to marketing cookies, Legal Monster prevents any tag categorised as marketing in Google Tag Manager to be set. By using Legal Monster, you can ensure that cookies set on your website through Google Tag Manager are compliant with data protection laws governing the use of cookies.

You can watch this video from Google that shows you how to use Google Tag Manager:

Before you start:

Before following these steps, please be sure that you have:

Step 1: Configure your triggers

First you must create a custom trigger in Google Tag Manager. Triggers define how and when to run a certain script/tag. 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:

Event name


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 event name and for analytics you must use the event name. .

Step 2: Create your tags

Next, you can add a new tag. Click on "Tags" in the side panel and then "New".

You can select a variety of default tags from the tag overview, or install your own through Google Tag Manager. Once you've selected your tag, you must associate it with the appropriate trigger.

Click "Save" and continue with the rest of your tags!

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.