- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
05-10-2018 07:07 AM - edited 05-10-2018 07:45 AM
Hello,
In "Tealium, GDPR, and Data Privacy" whitepaper (from Feb 27th), on page 18 I've read that it's possible to get consent state by using js function "getConsentState()". However, whenever I try to map that function as a UDO variable and call it in console, i get back info that it's undefined although it should be either array (in case partial category consent was provided) or a value of 1 (optin), -1 (optout) or 0 (not specified).
What am I doing wrong here?
Thanks
Solved! Go to Solution.
05-10-2018 09:28 AM - edited 05-10-2018 09:30 AM
Hi @amarkic
The call is actually:
utag.gdpr.getConsentState()
You are correct that it will return "1" for Opt-In, "-1" for Opt-Out, "0" for no consent given.
Partial consent will be an array and each item will be an object.
[
{ct:1},
{ct:0},
{ct:0},
...
]
Let me know if this helps!
05-11-2018 12:50 AM - edited 05-11-2018 01:16 AM
05-11-2018 08:02 AM
Apologies that it didn't work for you. Based on my quick testing, it appears the code hasn't been published. I just tried on a site that doesn't have Consent Manager enabled and saw this same error, but on a site with Consent Manager enabled it did work. Are you able to open the utag.js file in the Developer Tools Sources tab and see if utag.gdpr exist in the contents of the file? If not, then the contents aren't being published to production.
I hope this points you in the right direction, if not you'll likely need to reach out to your Account Manager for support so they can loop in an Engineering to look at the configs and your site to see the cause.
Cheers,
-Dan
05-13-2018 04:18 AM
06-01-2018 09:00 AM
I would like to map the value of the consent state to a Google Analytics custom dimension (we are omitting GA from our consent manager scope). Can someone help with what are the steps to be able to get this value into a variable so I can map it in the GA tag?
06-04-2018 09:02 AM
You'll probably want to use a JS extension and leverage the following sample code.
var cs = utag.gdpr.getConsentState();
if (typeof cs != "undefined") {
if (cs == 1) utag.data.consent_state = "grant_full_consent";
else if (cs == 0) utag.data.consent_state = "no_consent_given";
else if (cs == -1) utag.data.consent_state = "decline_consent";
else if (typeof cs === "object") utag.data.consent_state = "grant_partial_consent";
}
Full disclosure, this is custom code and will need to be fully tested before used in a production environment.
Be sure to declare consent_state as a UDO var and then you can map it within the GA tag.
Hope this helps!
-Dan
06-04-2018 09:07 AM
You're my hero @dan_george!. #InAwe
06-04-2018 11:40 AM - last edited on 06-04-2018 12:02 PM by kathleen_jo
Copyright All Rights Reserved © 2008-2023