Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Read Cookie Adobe Launch

Avatar

Avatar
Ignite 1
Level 3
1982luca
Level 3

Likes

6 likes

Total Posts

315 posts

Correct Reply

0 solutions
Top badges earned
Ignite 1
Boost 3
Boost 1
Applaud 5
View profile

Avatar
Ignite 1
Level 3
1982luca
Level 3

Likes

6 likes

Total Posts

315 posts

Correct Reply

0 solutions
Top badges earned
Ignite 1
Boost 3
Boost 1
Applaud 5
View profile
1982luca
Level 3

27-09-2020

Hello everyone,

 

I am setting a cookie with _satellite.cookie.set(digitalData,digitalData); Basically I am thinking of storing the digitalData in th cookie, ONLY for authenticated users and re-use it where I need, by using _satellite.cookie.get. My question is, how to read the digitalData json ? For instance, how can i read  digitalData.user.customerId from the json cookie?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Publish 1
MVP
yuhuisg
MVP

Likes

195 likes

Total Posts

595 posts

Correct Reply

117 solutions
Top badges earned
Publish 1
Affirm 100
Springboard
Bedrock
Validate 1
View profile

Avatar
Publish 1
MVP
yuhuisg
MVP

Likes

195 likes

Total Posts

595 posts

Correct Reply

117 solutions
Top badges earned
Publish 1
Affirm 100
Springboard
Bedrock
Validate 1
View profile
yuhuisg
MVP

27-09-2020

Cookie values can only be strings. I haven't personally tried storing non-text values in cookies using _satellite.cookie.set(), but if it's working for you, then that means Launch is able to stringify the object before storing it as a JSON value in the cookie.

_satellite.cookie.get() would return the cookie's value as-is, i.e. as a string. To convert it back to its original type, use `JSON.parse()`.

E.g.

var digitalDataString = _satellite.cookie.get("digitalData");
var digitalData = JSON.parse(digitalDataString); // this is what you want
// you should now be able to get digitalData.customerId

 

Answers (0)