Using Cookie Information and Google Tag Manager

Using Cookie Information and Google Tag Manager

Setting up our solution within Google Tag Manager is very easy and only requires a few steps.

Insert the Consent Pop-up with Google Tag Manager

Step 1:

Login to your Google Tag Manager Account and choose the specific website.

Step 2:

Click on New Tag

GTM_POP-up_1.png

Step 3:

Click on Tag Configuration

GTM_POP-up_3.png

Step 4:

Choose Custom HTML TAG

GTM_POP-up_4.jpg

Step 5:

<script>
function LoadCookieInformation() {
var banner = document.createElement('script');
banner.type = 'text/javascript';
banner.setAttribute('data-culture','EN');
banner.src = 'https://policy.app.cookieinformation.com/uc.js';
document.head.appendChild(banner);
}
LoadCookieInformation();
</script>

GTM-scriptimplement.JPG

Remember to choose the right languages by setting the data-culture attribute to the right language code.

Language Codes

Data-culture

Language

Data-culture

Language

AR

Arabic

LT

Lithuanian

BG

Bulgarian

LV

Latvian

CA

Catalan, Valencian

MS

Malay

CS

Czech

NB

Norwegian Bokmål

DA

Danish

NL

Dutch, Flemish

DE

German

PL

Polish

EL

Modern Greek

PT

Portuguese

EN

English

RO

Romanian, Moldavian, Moldovan

ES

Spanish, Castilian

RU

Russian

ET

Estonian

SI

Sinhala, Sinhalese

FI

Finnish

SK

Slovak

FR

French

SL

Slovene

GA

Irish

SQ

Albanian

HE

Modern Hebrew

SR

Serbian

HI

Hindi

SV

Swedish

HR

Croatian

TA

Tamil

ID

Indonesian

TH

Thai

IS

Icelandic

TR

Turkish

IT

Italian

UK

Ukrainian

JA

Japanese

VI

Vietnamese

KO

Korean

ZH

Chinese

Step 5:

Go one step back and click on Triggering

GTM_POP-up_6.png

Step 6:

If you choose GTM's premade trigger All Pages then the Consent Pop-up will be shown on all pages with the selected data-culture(languages).

GTM_POP-up_7.png

If you have a multi-language website then you must match the data-culture attribute to the right trigger.

GTM_POP-up_7.1.png

Remember to click Save and Name your tag for later use.

Finally, remember to submit your work

GTM_POP-up_11.png

Using Google Tag Manager to block Cookies before consent

The Cookie Control SDK is enabled via the custom trigger, events and tags functions in Google Tag Manager(GTM) 

Events are fired by the script placed on your website including all the necessary logic to handle banners and widgets, so there is no need to implement our solution in the source code. 

By default, there are 4 basic cookie types:

  • cookie_cat_necessary - Cannot be deselected by the user
  • cookie_cat_functional
  • cookie_cat_statistic
  • cookie_cat_marketing

Those will also serve as triggers and event names.

Step 1

Setting up triggers

1. Navigate to the main dashboard, click "Triggers" section, and select "New"

2. Select "Custom Event" trigger from the list

customTrigger.png

3. Fill in the required inputs:

As the trigger's event name, use one of the existing cookie
categories listed above.

The trigger itself doesn't need to use the category name.

4. Repeat the steps above for all individual cookie categories to cover all the possible
choices of the end-user.

Step 2

Setting up tags

Now, with all triggers configure, we can continue and assign the content/functionalities we want to
serve on our website.

In this example, we'll use Google Analytics.

1. Start by choosing the type of tags you want to use. In this example, it’s Universal Google Analytics, but it could be any other tag

analyticsTag.png

2. Configure the tag according to your needs, and select a relevant trigger. In this example,
as we're configuring Google Analytics, we should use the cookie_cat_statistic event, which
was assigned to a trigger called "Statistic Cookie".

Remember that a trigger's event name is a key value, while the name of the trigger can be set according to your preferences and will not affect the trigger’s functionality.

Additional information

  • A tag can be called using a number of triggers. If more than one trigger is added, Google
    Tag Manager will require at least one of them to fire to execute the tag. 
  • Additionally, you can set how many times a tag can be triggered per a client’s visit. 
  • Remember to publish your changes or the tag will not work as expected.

Using Multiple triggers

In GTM you can't set up more than one triggers because that only ONE trigger has to equal TRUE for the tag to fire.

Therefore you will need to set our custom event as a condition for the main trigger.

Use the built-in variable: Event and set to be equal to [cookie category]

Eg.

When you can't use a custom event

Some tags can't take custom events as a trigger. eg click element or click links.

In that case, we need to create a custom javascript instead.

Change the cookie category accordingly

function() {
return window.CookieInformation.getConsentGivenFor('cookie_cat_marketing');
}

The function will return TRUE or FALSE

About Cookie Information

Cookie Information is a Privacy Tech Company specialized in developing software that helps you and your company ensure that your websites and mobile apps are GDPR & ePrivacy compliant. Cookie Information provides solutions globally, and we help more than 1.000 companies and handle more than 6 billion consents each year.
Visit Cookie Information