- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
04-28-2016 03:14 AM
Hi!
I want to save variable to cookie from data layer, but it saves cookie with [undefined] value.
The data was stored to [utag.data.tmo_dontshow_checkbox] variable by inline script in the [Modal offer] extension.
I created [Persist Data Value] extension to store this value in cookie, but it can save only text.
04-28-2016 10:14 AM
Hello @asdfcgvbh. Do you have a URL where we can see the error? Or perhaps a screenshot. We look forward to your reply.
04-28-2016 10:59 AM
Hello @asdfcgvbh, what scope does your Persist Data Values extension have?
By default, it will have a scope of "All Tags" while the Modal Offer extension has the scope of DOM Ready. In this scenario, the Persist extension will run prior to the Modal Offer extension so the data source value you are trying to store is not available yet.
One option would be to change your inline script in the modal extension to take the tmo_dontshow_checkbox data source value and store it in the utag_main cookie namespace:
utag.loader.SC("utag_main", {myVar: utag.data.tmo_dontshow_checkbox+"exp-session"}); //myVar persists for the current session
utag.loader.SC("utag_main", {myVar: utag.data.tmo_dontshow_checkbox}); //myVar persists for the life of utag_main
Either of the above methods will store your value in the utag_main cookie name space.
Copyright All Rights Reserved © 2008-2023