Use this Extension to save, or persist, a variable's data in a cookie of your choice for whatever duration you specify. This was previously known as the Persist Variables Extension.

Configuring the Extension

1. In Tealium iQ, navigate to the Extensions tab and add the Persist Data Value Extension, located under the Standard Data tab of the Extensions marketplace.

2. Enter a title for the Extension.

3. Choose the scope for this Extension, either a specific Tag or 'All Tags'.
If you decide to scope to All-Tags, you can also choose when to execute the Extension (Requires utag.js version 4.38 or higher; older versions may cause Extension to run more than once)

    • Before any Load Rules are evaluated
    • After any Load Rules are evaluated (Default)
    • After all the Tags have loaded

4. From the 'Persist' drop-down list, select either 'Text' or 'Variable'.

    • Text - This option allows you to save in the cookie any text you enter into the text field. This text does not change.
    • Variable - This option allows you to select a variable whose data you want to save in the cookie.

5. From the 'Duration' drop-down list, select the length of time that the data will persist in the cookie.

    • Session - The data remains in the cookie until the current visitor session ends.
    • Visitor - The data remains in the cookie until the visitor deletes the cookie.
    • Hours - The data remains in the cookie until the number of hours you specify expires.
    • Days - The data remains in the cookie until the number of days you specify expires.

6. From the 'Update' drop-down list, select when the value is to be replaced or updated.

    • Allow Update on Page View - Every time the visitor views the page, the data is updated. The duration timer resets with each update.
    • Keep First Value Set - Only the data from the first visit is saved. Subsequent visits do not alter this value.

7. Click the 'Add Condition' button to specify when to run this Extension. You may only add one condition.

8. From the 'Store in Cookie' drop-down list, select the cookie you want to store the variable's data in. If you do not have a cookie variable ready, click the plus button to create a new cookie variable.

9. Save and Publish.


Storing Data in a Cookie

You can store the data in the Tealium-provided cookie, utag_main, or in a 1st-party cookie from the originating site. If you wish to store the value in Tealium's utag_main cookie, create a new cookie variable 'utag_main_<name>, where <name> is the cookie value you wish to add to the utag_main cookie. Make sure this new cookie variable, utag_main_<name>, is listed in the Variables tab so the system can recognize and write to it.

Usage Example

We will go through a simple use case to provide some clarity.

In this scenario, we want to persist the visitor's location, namely the city, state, and zip code they originated from. This information is stored in a variable called 'city_state_zip'.

  1. Add the Extension.
  2. Enter a title.
  3. Leave the scope set to 'All Tags'. Keep the "Execution" drop-down set at default (After Load Rules).
  4. From the Persist drop-down list, select 'Variable'.
  5. From the resulting drop-down list to the right, select the variable 'city_state_zip (js)'.
  6. We will set the duration to 'Session'.
  7. Set the 'Update' field to 'Allow Update on Page View'.
  8. We will store this value in the utag_main cookie as 'location', so create the utag_main_location cookie variable by clicking on the plus icon next to the 'Store in Cookie' field.

Adding_Cookie_Value.png usage_example.png

When the page loads your data, it will be saved in the utag_main cookie as:

&#36;location:Los Angeles CA, 90010;exp-session

The '$' signifies a new cookie value, in this case the new cookie value is 'location'. The colon after location signifies the beginning of the variable's value, which is 'Los Angeles CA, 90010'. The semicolon delimits the end of the variable's value from the duration expiration, which we set to 'Session'.