Skip to main content
added 108 characters in body
Source Link
Macca
  • 8.3k
  • 1
  • 14
  • 22

David's correct. You can do it by setting the HTTP Header, but there's a more intuitive function out there. To set a cookie with SSJS:

Platform.Response.SetCookie("MyCookie", "MyCookieValue");

The SetCookie function has a few overloaded variants:

SetCookie(string name, string value)
SetCookie(string name, string value, DateTime expirationDate)
SetCookie(string name, string value, bool secureOnly)
SetCookie(string name, string value, DateTime expirationDate, bool secureOnly)

To set a cookie with SSJS:

Platform.Response.SetCookie("MyCookie", "MyCookieValue");

The SetCookie function has a few overloaded variants:

SetCookie(string name, string value)
SetCookie(string name, string value, DateTime expirationDate)
SetCookie(string name, string value, bool secureOnly)
SetCookie(string name, string value, DateTime expirationDate, bool secureOnly)

David's correct. You can do it by setting the HTTP Header, but there's a more intuitive function out there. To set a cookie with SSJS:

Platform.Response.SetCookie("MyCookie", "MyCookieValue");

The SetCookie function has a few overloaded variants:

SetCookie(string name, string value)
SetCookie(string name, string value, DateTime expirationDate)
SetCookie(string name, string value, bool secureOnly)
SetCookie(string name, string value, DateTime expirationDate, bool secureOnly)
Source Link
Macca
  • 8.3k
  • 1
  • 14
  • 22

To set a cookie with SSJS:

Platform.Response.SetCookie("MyCookie", "MyCookieValue");

The SetCookie function has a few overloaded variants:

SetCookie(string name, string value)
SetCookie(string name, string value, DateTime expirationDate)
SetCookie(string name, string value, bool secureOnly)
SetCookie(string name, string value, DateTime expirationDate, bool secureOnly)