persist data value don't works with variables

asdfcgvbh
Visitor
asdfcgvbh

 

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.

 

2 REPLIES 2

persist data value don't works with variables

kathleen_jo
Employee Emeritus
kathleen_jo

Hello @asdfcgvbh. Do you have a URL where we can see the error? Or perhaps a screenshot. We look forward to your reply. 

Remember to give me a kudo if you like my post! Accepting my post as a solution is even better! Also remember that search is your friend.
Highlighted

persist data value don't works with variables

Clint
Employee Emeritus
Clint

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.

  • utag.loader.SC is built-in cookie setting method for utag.js -- more info here
  • "utag_main" is the Tealium cookie namespace - we recommend using this to mitigate the against the browsers' cookie limit
  • "myVar" is the container/key for the value you want to store
  • utag.data.tmo_tmo_dontshow_checkbox is the data source containing the value you want to store in utag_main
  • exp-session (optional) sets the lifetime of myVar