In this submit we’ll see:
- What is the regulation of cookies?
- What have to be achieved to fulfill it?
- How to do it with Google Tag Manager?
- How to know if I have carried out nicely?
- 1 What is the regulation of cookies?
- 2 What must be finished to comply with the regulation of cookies?
- 3 How to comply with the cookie regulation with Google Tag Manager?
- 4 We begin!
- 5 1. Create Account and Container
- 6 2. Acquire and install the monitoring code
- 7 three. Create Macro
- 8 four. Create Guidelines
- 9 5. Create Labels
- 10 6. We save the modifications and publish
- 11 Labels
- 12 Guidelines
- 13 Macros
- 14 If at this point, all the things has gone nicely, we’ve got only one thing left: SAVE THE CHANGES. It seems a truism, but GTM is something however intuitive. For the modifications made to take effect, we should PUBLISH. That yes, I strongly advocate that you simply create a NEW VERSION of the container earlier than publishing something, as a result of that means we could have a historical past of the modifications and we will return to an earlier version in case of issues. When creating a new version, GTM assigns it the identify of the model number it’s. It is advisable to give a meaningful identify of the modifications made and the date, since in the present day and tomorrow you’ll keep in mind what you did, but in 6 months or 2 years it is rather doubtless that you do not keep in mind so properly. And that for those who solely handle the GTM you, but when managed by several individuals, will make life a lot simpler for everybody. FINISHED! 😀
- 15 How to know if I’ve carried out properly?
The well-known (and misnamed) cookie regulation is nothing more than the modification, by means of Royal Decree-law 12/2012 of March 30, the second paragraph of Article 22 of Regulation 34/2002 of July 11, providers of the knowledge society and digital commerce, higher often known as LSSI.
The article reads as follows:
After consulting with a lawyer, compliance with article 22 of the LSSI for the standard Net (it is convenient to consult a lawyer for each specific case) may be summarized in these 4 points:
- Clearly notify the consumer of using cookies and their objective.
- Get hold of the consumer's consent for the set up of cookies.
- Block the installation of cookies till you get hold of consent.
- Supply the required info to the consumer concerning the installed cookies, how to configure and uninstall them from the browser, if desired.
The Spanish Company for Knowledge Safety (AEPD) has developed a guide on using cookies. In this information we will discover, among different things, how to get hold of consent:
And the circumstances for the acquiring to be legitimate:
Another level to bear in mind is that not all cookies are subject to this article. There are exceptions:
Conclusion: it’s essential to warn of using those cookies that are not strictly needed for the functioning of the Website online and to block its set up till acquiring the consent on the part of the consumer.
In case all this seems like Chinese language, IABSpain developed in 2013 this infographic about cookies, which is far more digestible than the previous one of the AEPD.
Earlier than beginning, I would like to clarify that, with this entry, I intend to add worth to the answer revealed by Eduardo Sánchez Rojo in his weblog Analítica Práctica which, although it appears to me a genius, has some gaps. The authorship of the underlying concept and the supply code information uncovered on this entry is totally yours.
The answer proposed under is designed to management the Google Analytics cookie for an internet site developed in WordPress, which is the most typical state of affairs for the standard Net. For various instances, it will be mandatory to make some modifications (in the course of the entry, I’ll point out what they are).
Final June 2015, Google launched a brand new version of the Google Tag Manager software, which has undergone necessary modifications. Within the link that you’ve just above, you’ll discover the entry that I’ve written with the difference of the tactic to the new model. That if, in case you are new to using Tag Manager, take this entry to level 2. and the final half on how to verify in case you have accomplished nicely.
What is going to we’d like?
That you’ve never used Google Tag Manager (GTM) and have no idea how it works? Don’t worry, all you’ve got to know is that, with this software, we’ll handle virtually all labels from Tag Manager and that, as well as, we will impose circumstances (referred to as Rules in GTM) to every of the labels … and there’s the key challenge, as defined within the subsequent part. Google itself has prepared a video tutorial that, in less than 4 minutes, explains the essential operation of this device and the way to install its code on our web site. The video is in English, with subtitles out there in Spanish.
What are we going to do?
What we’re going to do is the next:
- By creating a collection of guidelines and labels in Google Tag Manager, we’ll block the execution of the Google Analytics tag till at the very least one of the actions on the a part of the consumer that we think about to be clear and vital, that will probably be 2: that the consumer scroll with the mouse or click on a hyperlink. In this approach, we’ll only install the Analytics cookie when the consumer has given their consent. In some instances, like the original answer of Eduardo Sánchez, they think about as a big action the passing of a sure time. Nevertheless, the AEPD leaves it crystal clear: “In any case the mere inactivity of the user does not imply the provision of consent by itself,” as we will see slightly extra in this similar entry. Subsequently, it isn’t a legitimate action and I have removed it from the answer.
As you possibly can guess by the title of the entry, I'm going to give attention to point 3: Google Tag Manager.
1. Create Account and Container
If in case you have never used Google Tag Manager before, the very first thing it is best to do is create an account and, within it, a container. This entry isn’t meant to be a tutorial on how GTM works, however suffice it to say that the concepts of Account and Container are analogous to these of Account and Property that appear in Google Analytics. A Google account can include several GTM accounts, a multiple container account, and the containers are unbiased of each other. The most typical use is given to create an account per company and one container per area, but each can manage as you would like.
First, we identify the account and click on “Next”:
Later, we may have to give a reputation to the container and add, in our case, the domain of the Net web page:
2. Acquire and install the monitoring code
We already have the account and the container created, so we are already able to get hold of the tracking code of the container that we should copy and paste on our web site. Emphasize that there is a monitoring code per container, not per account. Where do we find the code? Here:
On the left of the display, we’ll discover the primary menu. We click on “Administrator” (which, originally, will appear without the choices displayed) and, later, we click on the choice “Install GTM”:
As soon as this is finished, we’ll get one thing like the following:
Now you need to copy this code and paste it in all the pages of the Net. How do I do this in WordPress? Nearly all WordPress templates have two information referred to as “header.php” and “footer.php” that each one pages share. Talking in Spanish, the menus of your Net (header.php) by way of which you browse the Net and the footer of the page the place you set “Copyright 2014” (footer.php) appear on all pages throughout navigation. Subsequently, with putting this code within the opening of the (that’s, slightly below where you set it ““) Of one in every of these two information, we might have already accomplished it.
To do this, it’s essential to go to “Appearance” -> “Editor” and you will notice on the fitting an inventory of the information with extension .php which you can modify, amongst which the information header.php and footer.php have to be discovered. You simply have to look for the of the file and paste the code slightly below.
Through which of the two information is it better to paste the code? There are opinions for all tastes. The primary difference is that, for those who put it within the header.php, will probably be executed before the complete Net is loaded (particularly if it’s a heavy Net) and, should you put it within the footer.php, it is going to be last things to be executed. I choose to put it within the header.php. In fact, select the one you select, paste the code solely in one of the two information, by no means in both.
three. Create Macro
Once inside the Google Tag Manager interface, we'll see one thing like the next:
By clicking on the purple “NEW” button, 3 options shall be displayed: Label, Ruler and Macro. We’ll begin by creating a Macro with the next parameters:
With this Macro, what we’ll get is that Google Tag Manager learn the content material of acepcookie, if it exists (if it’s the 1st visit or if the consumer has deleted cookies in the browser, acepcookie would not be installed … but), each time the page is loaded
four. Create Guidelines
We’ll create three Rules that may permit us to hold the set up of the Analytics cookie blocked or not.
Rule 01: Execute in all URLs IF there’s acceptance
The labels assigned to this rule will probably be executed in all URLs if, and only if, the cookie acceptscookie and its value is equal to “yes”.
Rule 02: Execute on all URLs if there’s NO acceptance
The labels assigned to this rule will probably be executed in all URLs if the cookie does not exist acepcookie or, if it exists, its value is totally different from “yes”.
Rule 03: AcceptCookie Occasion
Labels which have this rule assigned can be executed when the Event matches the common expression (acepcookies | gtm.linkClick) and the worth of the Macro ExceptionAption is totally different from “yes” (and this would be the case when the cookie acceptscookie doesn’t exist or , if any, its value is totally different from “yes”).
5. Create Labels
We reached the last step: create the Labels. And right here is the guts of the matter. The following labels are people who, governed by the principles of the earlier point, will detect the actions that give the consent of the consumer and, consequently, will set up the cookie acepcookie to keep in mind, in future visits, that the consumer has already given his consent.
Label 01: 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 might have the code by clicking right here
IMPORTANT: Don’t forget to assign the activation rule 03 – AcceptCookie Event as shown within the seize.
Label 02: Google Analytics monitoring code
As is logical, if we would like the Google Analytics cookie not to be installed with out the consumer's consent, we should management it from GTM. Subsequently, we should take away it from the Net (if in case 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 need is to block other cookies than Google Analytics, this 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 means as we do in this label.
GTM has predefined labels for both Google Analytics Basic and Universal Analytics. Nevertheless, we’ll choose to copy and paste the tracking code into a “custom HTML” tag. Why? Because the predefined labels take away management over the code and, though we might edit many choices of the configuration of the code, we couldn’t edit them all and the complication of creating one sort of label or one other is (for my part) exactly the same.
How can we get hold of the Google Analytics monitoring code? A) Sure:
IMPORTANT: Do not forget to assign the activation rules 01 – Execute in all URLs IF acceptance exists and the 03 – AcceptCookie Event as proven in the capture.
This tag, of sort “Click-to-link processor” (found in “Event processor” when displaying the Tag sort choices) will detect when the consumer clicks on a hyperlink. That’s, when the consumer continues shopping the Net.
IMPORTANT: Don’t forget to assign the activation rule 02 – Execute in all URLs if there’s NO acceptance as shown within the seize.
Label 04: Detect scroll
This “custom HTML” sort tag detects, as its identify indicates, when the consumer scrolls within our Net. You’ve got the code by clicking right here.
IMPORTANT: Don’t forget to assign the activation rule 02 – Execute in all URLs if there’s NO acceptance as shown in the seize.
6. We save the modifications and publish
At this level, if we’ve got created the macro, guidelines and labels appropriately, we should always have one thing like this:
If at this point, all the things has gone nicely, we’ve got only one thing left: SAVE THE CHANGES. It seems a truism, but GTM is something however intuitive. For the modifications made to take effect, we should PUBLISH. That yes, I strongly advocate that you simply create a NEW VERSION of the container earlier than publishing something, as a result of that means we could have a historical past of the modifications and we will return to an earlier version in case of issues. When creating a new version, GTM assigns it the identify of the model number it’s. It is advisable to give a meaningful identify of the modifications made and the date, since in the present day and tomorrow you’ll keep in mind what you did, but in 6 months or 2 years it is rather doubtless that you do not keep in mind so properly. And that for those who solely handle the GTM you, but when managed by several individuals, will make life a lot simpler for everybody.
How to know if I’ve carried out properly?
We have now already carried out the whole lot we had to do, but … how do we all know if we have now finished properly?
Cookies are put in in browsers (if we enter the identical Net web page, from the identical pc however once from Firefox and a second time from Chrome, we might be two totally different individuals in the eyes of Analytics), subsequently, that is the place we must verify if the cookie has been installed, or not, with out having given the consent. I will take for instance the browser Mozilla Firefox, but we will perform this examine with any browser. That sure, every one could have its personal construction of menus and configurations.
To entry the primary menu, we’ve a button with 3 horizontal strains at the top-right of the display () With which the next menu might be displayed:
We click on on Options and Privacy the following will seem:
We click on delete cookies individually. We could have the following:
In the higher half, we’ve a search engine, which we’ll use to find extra shortly the Net that we would like to analyze, in my case, “albertoestevescorreia.com”. We’ll see an inventory of cookies that, from that web site, have been installed in our browser. In case you are analyzing an internet site that you’ve previously visited and that uses Google Analytics, you’ll get the corresponding cookie (in my case, the Universal Analytics).
To carry out the check, we’ll comply with these three factors:
- We click on on the “Delete all cookies” button and shut this window.
- Then, we re-enter the Net (either pressing F5 if we have been already inside or opening a new tab)
- WITHOUT MAKING ANY ACTION (or scroll or click on any hyperlink on the Net, otherwise we might be giving consent) we carry out steps 1, 2 and three to verify that the Analytics cookie has not been put in within the browser .
If the earlier steps have gone properly, we may have checked that the cookie just isn’t put in till the consumer provides consent.
To verify if it actually detects the scroll or clicks on links and these actions trigger the execution of the Analytics code, it is enough to do considered one of these two actions: scroll or browse the Net.
I hope you’ve served this publish to catch up with the joyful regulation of cookies and don’t hesitate to share freely with whomever you want.
Human information belongs to the world
P.D .: For probably the most curious, with this technique you possibly can examine if other Net pages are installing cookies with out your permission. You’d be stunned by the massive number of web sites that don’t comply with this regulation, particularly contemplating that the AEPD has already imposed the primary fines and that these can attain € 30,000 or even € 150,000 if it’s a violation critical.