Such as Cookiebot or OneTrust, Iubenda has adapted to the category management of Cookies too.
The recent official European Data Protection Board guideline explicitly declare that the GDPR is not compliant with legal standards, if the consent is NOT granular and/or if the scroll is used as acceptance.
So since May 2020, it’s possible to manage granular category consent with Iubenda.
That’s good news! But this involves further configurations in GTM.
Iubenda has 5 categories in its standard version.
1
)Purposes included:
2
)Purposes included:
3
).Purposes included:
4
).Purposes included:
5
).Purposes included:
It really developed a clear list to avoid bad interpretations. So a similar thing will appear in the banner:
Let’s go with GTM configuration now!
Go to your Iubenda account and generate the script by using “Cookie Solution” item.
You should find a text area where you’re able to copy the code just like the image below:
In detail the code will be something like this:
<script type="text/javascript"> var _iub = _iub || []; _iub.csConfiguration = { "consentOnContinuedBrowsing":false, "whitelabel":false, "lang":"it", "siteId":XXXXXXXX, "countryDetection":true, "perPurposeConsent":true, "cookiePolicyId":YYYYYYYYY, "cookiePolicyUrl":"demo.tagmanageitalia.it/esempio/", "banner":{ "acceptButtonDisplay":true, "customizeButtonDisplay":true, "position":"float-top-center", "rejectButtonDisplay":true } }; </script> <script type="text/javascript" src="//cdn.iubenda.com/cs/iubenda_cs.js" charset="UTF-8" async></script>
The parameters in red color are dynamic. They change depending on how you implement the cookie solution on Iubenda and the site destination (in my case demo.tagmanageritalia.it).
In my case, the cookiePolicyId code is 20508754 (you’ll see it later) in the screenshots below.
Here’s an example:
<script type="text/javascript"> var _iub = _iub || []; _iub.csConfiguration = { "lang": "it", "siteId": XXXXXX, "cookiePolicyId": YYYYYY, "banner": { "position": "float-top-center", "acceptButtonDisplay": true, "customizeButtonDisplay": true }, }; </script> <script type="text/javascript" src="//cdn.iubenda.com/cs/iubenda_cs.js" charset="UTF-8" async></script>
As you can see the values in red remain 🙂
Now that you get the script you will need to add a piece of code to instruct Google Tag Manager when the user accepts one of the five categories or not.
This instruction will be sent with a dataLayer push by using a custom event.
You have to add blue values to the code. The code will be something like this:
<script type="text/javascript"> var _iub = _iub || []; _iub.csConfiguration = { "consentOnContinuedBrowsing":false, "whitelabel":false, "lang":"it", "siteId":XXXXXXXX, "countryDetection":true, "perPurposeConsent":true, "cookiePolicyId":YYYYYYYYY, "cookiePolicyUrl":"demo.tagmanageitalia.it/esempio/", "banner":{ "acceptButtonDisplay":true, "customizeButtonDisplay":true, "position":"float-top-center", "rejectButtonDisplay":true }
, callback: { onPreferenceExpressedOrNotNeeded: function(preference) { dataLayer.push({ iubenda_ccpa_opted_out: _iub.cs.api.isCcpaOptedOut() }); if (!preference) { dataLayer.push({ event: "iubenda_preference_not_needed" }); } else { if (preference.consent === true) { dataLayer.push({ event: "iubenda_consent_given" }); } else if (preference.consent === false) { dataLayer.push({ event: "iubenda_consent_rejected" }); } else if (preference.purposes) { for (var purposeId in preference.purposes) { if (preference.purposes[purposeId] && ({{cookie iubenda}} === undefined || {{cookie iubenda}}.indexOf('"' + purposeId + '":true') < 0)){ dataLayer.push({ event: "iubenda_consent_given_purpose_" + purposeId }); } } } } } } }; </script> <script type="text/javascript" src="//cdn.iubenda.com/cs/iubenda_cs.js" charset="UTF-8" async></script>
Let’s insert this code in a custom HTML tag.
Here’s an example:
To understand if the user has accepted several categories of profiling you can use a smart trick.
A Iubenda cookie saves the consents and the cookie bar will no longer appear during page changes.
It’s possible to catch Iubenda cookie with Google Tag Manager. It will appear link this:
_iub_cs-XXX
XXX stands for Iubenda cookiePolicyId. In my case, it will be: 20508754
Let’s create the variable:
Use Preview and Debug Mode to check the Iubenda cookies bar appears.
In my example, you can see also a Google Analytics tag unlocked.
If the user accepts all cookies, you will see a series of custom events in the left and Iubenda cookie triggered.
Custom events are called:
Iubenda cookie has a value like this:
{"timestamp":"2020-06-11T12:46:23.993Z","version":"1.20.6","purposes":{"1":true,"2":true,"3":true,"4":true,"5":true},"id":20508754}
You can find items that you must to focus on in blue.
Next steps:
You will have to repeat this step 5 times, changing the event name.
The number identifies the category:
Let’s configure iubenda_consent_given_purpose_1
Do the same for:
Great, now let’s create the 5 variables that will allow you to understand from the Iubenda cookie if the user has accepted one of the specific categories or not.
This step is necessary to create universal negative triggers 🙂
At this point, you have a variable containing the Cookie of preferences. Now you can create 5 variables to manage all categories of consents. To do this you have to use regular expressions.
Do the same for the other 4 variables by changing the value within the pattern: enter the appropriate number and name.
The second one:
The third one:
The fourth one:
The fifth one:
Here’s the final result:
Now I tell you.
The user’s preference value will appear before DOM Ready.
In other words, there will be no more problems in the management of Google Tag Manager’s Built-In Events (such as the Page View which is called Container Loaded since 10 June 2020).
Yuppieeeeeeee!
Almost there, let’s create universal negative triggers and configure tag 🙂
This trigger type has the particularity of adapting to any event type. So it doesn’t matter if Google Analytics tag or Facebook will be fired on click, scroll, and so on.
You will have to create 5 triggers, one for each category.
Universal negative trigger blocks any tag firing if it’s configured as “trigger in exception”.
So if the user doesn’t accept a specific Iubenda category, you have to create a trigger.
Nothing complicated: now I’ll explain it 🙂
Do the same for the remaining 4 triggers.
The second one:
The third one:
The fourth one:
The fifth one:
Yeah! You did it, now you just have to configure all the tags based on the category.
Thanks to the combination of Custom Event Triggers and Universal Negative Triggers you can implement any tag type, for example Google Analytics pageview tag (you can set it as Measurement).
At this point, you have to add 2 triggers to be in compliance with the GDPR:
Before publishing any changes, check the correct tag functioning by activating the Preview and Debug Mode.
You can see that Universal Negative Trigger blocks anything 🙂
Great! Thanks to Google Tag Manager you can correctly implement category consent with Iubenda.
What do you think about this guide? Do you think it is helpful? Let me know in the comments below.
Buon Tag 😉
LUISAVIAROMA è uno dei principali fashion e-tailer di lusso al mondo, con oltre 5 milioni…
All’interno del vasto e competitivo mercato della Grande Distribuzione Organizzata (GDO), Mondo Convenienza rappresenta uno…
Se ti occupi di marketing o advertising, saprai che i funnel rappresentano il percorso che…
È stato un nuovo record per il GA4Summit: oltre 500 professionisti e professioniste del web…
Negli ultimi mesi hai notato in Google Analytics 4 un calo improvviso e inspiegabile nelle…
Se ti trovi su questa guida è perché hai compreso che solo attraverso la Data…
View Comments
Ottima guida, complimenti e grazie
Di nulla :)
ciao guys, isn't it that iubenda is supposed to do all this automatically? they say nothing about adding all those tags
It's because you can add it with the plugin on your CMS. But I suggest this configuration :)