Why is my cookie returning undefined?

Bronze Contributor
Bronze Contributor

I'm in a preload scope, I created a cookie I can clearly see in utag_data.

However, when I want to reach out this cookie it is indicate undefined. 

How is that possible ?

1 REPLY 1

Why is my cookie returning undefined?

Employee Emeritus

@ELSAGUILLON 

The feature of a preloader is to run code before utag.js has completed.  At the point a preloader runs, utag_data will only contain the values that it is originally defined with on that page.  It will not contain cookies, dom variables, or any other Tealium provided variables and therefore you will not have access to use those variables from a Tealium perspective.

If you do want to check the value of a cookie, you can use a function similar to what is described here:

https://stackoverflow.com/questions/5968196/check-cookie-if-cookie-exists

 

Public