utag.loader.SC reset

Gold Contributor
Gold Contributor
Hi, We had some code which resets a cookie with a new value as follow: // reset the cookie with new value if it exists utag.loader.SC(cookie_name, b[ds]); If I store a url say "abcdefghij/test.html" Now next time let us say I reset the cookie with a new value "abc/test.html" When I read the cookie with utag.loader.RC(cookie_name) I get "abc/test.htmlst.html" So am first deleting the cookie before resetting it to a new value. Is there something I missed, or is the cookie being stored this way and needs to be cleared before i write into it again? Thanks, Sriram
1 REPLY 1

utag.loader.SC reset

Tealium Employee
Hi Sriram, Which browser are you using where you see this? In Firefox, when I run: utag.loader.SC("utag_main", { mycookie: "abcdefghij/test.html;exp-session" }); I see the mycookie parameter applied to the utag_main namespace with the correct value. See 1st attached screenshot. If I then run: utag.loader.SC("utag_main", { mycookie: "abc/test.html;exp-session" I see the mycookie parameter correctly updated with the new value. See 2nd attached screenshot. I should note that I'm surprised the RC call is actually returning a result. That method is really only meant to be used on page landing to read document.cookie and inject the 1st party cookies into the data layer. What I would suggest doing is also setting the data layer value and read that: utag.loader.SC("utag_main", { mycookie: "abcdefghij/test.html;exp-session" }); utag.data["cp.utag_main_mycookie"]="abcdefghij/test.html"; Then if you want to read the cookie value you can just reference the data_layer instead of having to re-parse all cookies and adding more logic.
Public