Analítica Web Web

How to comply with Google Tag Manager V2

In this publish, I advised you what it’s and what have to be finished to comply with the 'regulation of cookies' and how to do it with Google Tag Manager (GTM). Nevertheless, on June 1, 2015, Google revealed a new model of Google Tag Manager, which has skilled essential modifications in its operation that make it unattainable to implement the answer proposed within the unique entry.

To summarize, in case you haven’t learn the original entry, I will say that so as to comply with the regulation of cookies it is needed to warn of using those cookies that aren’t strictly vital for the functioning of the website and block its set up till acquiring the consent by part of the consumer, which we’ll contemplate given when clicking on a link or scroll, actions accepted by the Spanish Agency for Knowledge Safety (AEPD) as obtaining consent.

Then, after consulting several colleagues of career (particular mention for MarujeoSEM Marketineo) and doing several exams, I’m going to inform you concerning the adaptation that I have made for this new model of Google Tag Manager. I can’t touch upon probably the most trivial steps comparable to the place and how to set up the GTM code or the Google Analytics code, since that does not change and you continue to have it in the aforementioned entry. Now sure, let's go there!

1. Varibals (previous Macros)

We must create the variable Exception of sort 'cookie of origin':

Acceptcookies might be a technical cookie (subsequently, being technical, it isn’t subject to compliance with article 22 of the LSSI and we will install it with out prior notice to the consumer) that may permit us to know if the consumer has not but accepted using cookies or , on the contrary, it has already accepted it.

In addition, we should activate the following built-in variables:

    Integrated variables enabled Google Tag Manager

2. Activators (previous Guidelines)

We’ll create 4 activators:

2.1 Click on on link

In the earlier version of GTM, we detected clicks on hyperlinks via the event processor, however in this new version that performance has disappeared. Now, we’ll do it by creating a Click activator:

Activator Type for Link Click

Segmenting the clicks to “only links”:

Configuration Activator Click on link

And we configure it to be activated on all pages only if the consumer has not accepted using cookies. That’s, when “Page URL” matches the common expression. * And the variable Except is totally different from 'sure':

Activation rules for Activator Click on link

2.2 Event acepcookies

As we’ll see later, we’ll create a label that detects and launches an event (which I have referred to as acepcookies) when the consumer performs an acceptance action (click on link or scroll). When that happens, this activator can be liable for executing the Google Analytics code and launching one other tag that modifications the value of the cookie acepcookies to 'yes'.

To realize this, we created a customized Occasion sort trigger, with the next configuration:

Activator of Google Tag Manager of the Acceptcookies Event

2.3 NOAceptaCookies

We create an activator that detects if the consumer has not but accepted using cookies, with the following configuration:

Activator NOAceptaCookies from Google Tag Manager

Event: Page view

Activator sort: Web page view

Activate: on any web page when Exception isn’t equal to 'sure'.

2.four SIAceptaCookies

Finally, we create an activator that detects if the consumer has accepted using cookies:

Google Tag Manager SIAceptaCookies Activator

Choose Event: Custom Occasion


Occasion identify: acepcookies

Execute when Exception is equal to 'yes'

three. Labels

Now we solely have to create three tags: one that accommodates the Google Analytics code, one that puts the worth 'yes' to the cookie acceptscookies and one which detects when the consumer scrolls and launches the activator 'Event acepcookies':

3.1 Place acceptance

This “custom HTML” sort tag is a JQuery script that may create and install the acepcookie technical cookie with the value “yes”. You’ve the code by clicking right here

Google Tag Manager Tag Place Acceptance

I had to make some slight modification of the unique code. Right here you could have the modified model, which is what you need to copy and paste:

Attention to the activation guidelines. If we click on the "More" choice, at this level it is best to have one thing like this:

Label Activators Place Acceptance

Choose: Click on on link and Occasion acepcookies

three.2 Detects scroll

This "custom HTML" sort tag detects, as its identify indicates, when the consumer scrolls within our Net:

    Google Tag Manager Tag Detects scroll

The code, to which I have additionally made a slight modification, you will have it here:

In this case, the activator might be NOAceptaCookies, so that it is just executed if the consumer has not yet accepted using cookies. Otherwise, its execution isn't vital.

3.three Universal Analytics Code

As in the earlier model of GTM, if we would like the Google Analytics cookie not to be installed without the consumer's consent, we must management it from GTM. Subsequently, we must take away it from the Net (when you have not yet carried out Analytics on the Net, there's nothing to delete) and create a label in GTM for it.

Say that, if what you want is to block other cookies than Google Analytics, that is the place you should make modifications and create a label with the code that installs these cookies (and remove them from the Net) in an analogous method as we do on this label.

Although GTM has pre-defined tags for Google Analytics, we'll select to copy and paste the monitoring code right into a "custom HTML" tag to have absolute control of the code.

    Google Analytics Code Label

Particular attention to the activation options:

Activators for the Google Analytics Code Label - Choosing activators

We choose "Click on link", "Event acepcookies" and "SIAceptaCookies". On this method, the tag with the Google Analytics code will only be executed when the consumer clicks on a link, when the occasion accepts cookies that's launched when the consumer scrolls or if the consumer has beforehand accepted using cookies. . That is to say…

We comply with the regulation of cookies!

4. We save the modifications and publish the container

At this level, if we have now created the macro, rules and labels appropriately, we should always have something like this:


List of Google Tag Manager Activators


Final list of Tags in Google Tag Manager


Final list with all the built-in variables of Google Tag Manager

Final list with all user variables

If at this level, the whole lot has gone properly, we now have just one thing left: SAVE THE CHANGES. It seems a truism, however GTM is anything however intuitive. For the modifications made to take impact, we must PUBLISH.

Finished! 😀

You'll be able to see a simple technique to examine when you have executed nicely and it works, at the finish of the original entry, precisely ... HERE!

And here's the ticket in the present day! I hope you could have served to catch up with the completely satisfied regulation of cookies and do not hesitate to share freely with whomever you like.

How to meet #leydecookies with Google # TagManagerV2 #lopd #Analytics Click To Tweet