1

I would prefer not to use javascript to set a cookie if possible. I am pretty sure it's possible to read a cookie using HTTPRequestHeader(S1), but I'd like to be able to set one when a user submits a form.

2 Answers 2

1

You can use SSJS. There's a SetValue and GetValue function for the HTTPHeader:

1
  • Any suggestions on how to set a cookie using SSJS? Reference this question
    – Daniel
    Commented Jun 9, 2016 at 15:46
1

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)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .