Reply
Highlighted
Regular Visitor
Posts: 8
Registered: ‎10-17-2017
Accepted Solution

How to get current consent state for user?

[ Edited ]

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

Reply
0 Kudos
Tealium Employee
Posts: 682
Registered: ‎09-01-2015

Re: How to get current consent state for user?

[ Edited ]

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!

 

 

Regular Visitor
Posts: 8
Registered: ‎10-17-2017

Re: How to get current consent state for user?

[ Edited ]

EDIT: Never mind, found a notification from two days ago that explains everything. Thanks :)

Hi Dan,

unfortunatelly, it's not working... It seems that utag.gdpr is not defined...

con1.jpg

con2.jpg

Tealium Employee
Posts: 682
Registered: ‎09-01-2015

Re: How to get current consent state for user?

@amarkic

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

Regular Visitor
Posts: 8
Registered: ‎10-17-2017

Re: How to get current consent state for user?

It's working, but it requires "Consent prompt management" to be active in "My IQ" tab...

Reply
0 Kudos