On a CloudPage, you may want to set a cookie so that if a user revisits the page, they can be shown something else on the page or redirected to a different page.
This SSJS function only allows you to set session cookies and not persistent cookies. This means that if the user closes their browser, the cookie will be deleted and you’ll lose the relevant information stored in that cookie.
The SetCookie function allows you to set the cookie name, cookie value, and date and time when the cookie expires. The boolean value of ‘true’ is optional to indicate whether or not the cookie only works with an HTTPS connection.
Properties are below. Values 3 and 4 (the date and time and HTTPS connection) are optional.