Expand my Community achievements bar.

The Analytics Community Lens news letter for February 2024 is now here! Come see upcoming events and what's been going on in the community!

_satellite.cookie.set does not set cookies

Avatar

Level 3

We see that _satellite.setCookie is depracated and that we are to use the _satellite.cookie.set instead when we look at the Chrome developer console.  We tried changing the code to _satellite.cookie.set instead and the cookie is not getting set even though we did not have any build errors.  Has anybody else hit this? 

4 Replies

Avatar

Community Advisor

I usually just set cookies the old "tried and true" way with JS

Avatar

Level 4

Is the cookie being set if you are trying it from browser console? If yes, it should usually work from the build as well.

Avatar

Community Advisor

Just to be clear, where you used to use 

_satellite.setCookie("cookieName", "cookieValue")

you have changed that to

_satellite.cookie.set("cookieName", "cookieValue")

Correct?

Reference: https://experienceleague.adobe.com/docs/experience-platform/tags/client-side/satellite-object.html?l...

You can also consider using the Further Toolkit extension, which comes with Action types for setting and getting cookies (and session/local storage too).

Avatar

Community Advisor

I just tested:

_satellite.cookie.set("cookieName", "cookieValue")

 

and

 

_satellite.cookie.set("cookieName2","cookievalue", {expires: 7});

(which passes the optional expiry time frame)

 

In my browser console, both work for me.

 

 

One possibility may be that the server itself is preventing cookies from being set... I've had a few Dev servers that actively prevented cookies from being written, including the ECID cookie which made testing challenging. There might be something similar in your case @valerie_anders