Cookies can store and retrieve information across pages on the same domain. Use the Util.cookieWrite() method to set a value to a cookie. You can use the Util.cookieRead() method to retrieve values set using Util.cookieWrite().

Set cookies using tags in Adobe Experience Platform

The Data Collection UI does not provide the ability to set cookies in the interface. Use the custom code editor, following AppMeasurement syntax.

s.Util.cookieWrite() in AppMeasurement and custom code editor

Call the s.Util.cookieWrite() method to set a cookie to a desired value.

s.Util.cookieWrite("example_cookie","Example cookie value")

An optional third argument is available that determines when the cookie expires. Cookies set using s.Util.cookieWrite() expire at the end of the browser session by default.

// Set a cookie with an expiration 6 months from now
var cookieDate = new Date();
cookieDate.setMonth(cookieDate.getMonth() + 6);
s.Util.cookieWrite("example_cookie","Example 6-month cookie",cookieDate);


You can instantiate a variable upon success of writing a cookie. This variable is a boolean.

var success = s.Util.cookieWrite("example_cookie","Example cookie value");
if (success) {
  console.log("Cookie written successfully");
} else {
  console.log("Cookie write failed");

On this page