How can I parse out a cookie value into variables?

Gold Contributor
Gold Contributor
Say I have a cookie variable named "primarycookie" and the value outputted is "var1:true$var2:false$var3:test$var4:true". How can I parse out the values and make them javascript variables? For reference, I need the variables defined in the utag.sync because I need to use it for Adobe Target. I've gotten as far as using the function .split() but having trouble figuring out how to convert it into JavaScript variables easily without doing it manually one by one. Any help is appreciated!
3 REPLIES 3

How can I parse out a cookie value into variables?

Employee Emeritus
what is the scope of your extension Landin Gee?

How can I parse out a cookie value into variables?

Gold Contributor
Gold Contributor
Hi Clint, I apologize and I forgot that I needed it in the utag.sync so it would not be in an extension.

How can I parse out a cookie value into variables?

Gold Contributor
Gold Contributor
Thanks Brian! Greatly appreciate your help.
Public