Highlighted

Cookie with multiple values - how to set one in an Adobe Analytics variable

Rookie Contributor
We have values set in a cookie: utag_data.cp.currentUser = {"email":"pheavey@gmail.com","is_advantage_member":false,"first_name":"Patrick"... Want to set the value of "is_advantage_member" to a SC variable. Thanks.
8 REPLIES 8
Highlighted

Cookie with multiple values - how to set one in an Adobe Analytics variable

Tealium Employee
(Edited to remove typo) If you add the SC variable as a UDO data source in the data layer, then set it using a set data values extension, set to jscode of something like utag.data["cp.currentUser"].split(",")[1].split(":")[1]; Which isn't the tidiest but should do the trick. You can then map it to SC accordingly.
Highlighted

Cookie with multiple values - how to set one in an Adobe Analytics variable

Rookie Contributor
This seemed to have completely broken the utag.
Highlighted

Cookie with multiple values - how to set one in an Adobe Analytics variable

Tealium Employee
Hi Patrick, It looks like Steve's code had an extra period at the end of the statement, just before the semicolon - perhaps that's why it didn't work? Craig.
Check out our new Swift integration library for iOS, macOS, tvOS and watchOS: https://github.com/Tealium/tealium-swift with updated
documentation https://community.tealiumiq.com/t5/Swift/tkb-p/swift.
Highlighted

Cookie with multiple values - how to set one in an Adobe Analytics variable

Tealium Employee
I'm very sorry about that, I'm not sure how the extra character got in there. I have edited the above post to prevent any future problems.
Highlighted

Cookie with multiple values - how to set one in an Adobe Analytics variable

Rookie Contributor
I made the change as above, but the value passed in the SC variable is "false".
Highlighted

Cookie with multiple values - how to set one in an Adobe Analytics variable

Tealium Employee
You presumably want it to be false, without the quotes?
Highlighted

Cookie with multiple values - how to set one in an Adobe Analytics variable

Rookie Contributor
Sorry, my bad - there are no quotes. I had in my head that the value should be something different, but "false" is correct. Thanks for your help!
Highlighted

Cookie with multiple values - how to set one in an Adobe Analytics variable

Tealium Employee
Ah, that's good - I'm glad that it's working. Thanks.