SetCookie

Overview

Sets the name and value of the specified session cookie

note: When working with cookies, ensure the user experience complies with the protections of a user’s jurisdiction.

Compliance with privacy protections for cookies can include multiple strategies:

  • Ensuring that a cookie notice is provided, and recommending that users read the cookie notice.
  • Ensuring consistency between your cookie consent language and Salesforce’s privacy notices and policies.
  • Asking the user for consent to use of cookies, for each category of cookie (first or third-party). For example:
    • Consent to Salesforce (first-party) cookies that validate user identity are critical to use of the site. But, consent for them can't be taken to imply consent to third-party cookies.
    • Consent to Salesforce partners' (third-party) analytics cookies must be acquired and tracked separately from consent to first-party cookies.
  • Asking in a way that ensures the validity of a user’s active and explicit consent:
    • Avoid pre-set, or checked, checkboxes for compliance.
    • Don't construe that merely continuing to use the web service is consent.
  • Allowing the user to withdraw their consent at any time, and for each category of cookie, depending on the cookie's purpose and origin (1st or 3rd party cookies).
  • Periodically reminding the user that they consented to cookies, as well as what cookies they consented to.
  • Not allowing cookie respawning without again collecting validated user consent.

This list is a start, but isn't exhaustive. Place cookie consent high in your list of functionalities to implement.

Syntax

SetCookie(1, 2, 3, 4)

Function Properties

<!--complex table-->
Ordinal Type Description
1 string Required Session cookie name
2 string Required Session cookie value
3 datetime Date and time value indicating cookie expiration
4 Boolean Indicates whether cookie works with only HTTPS connections

Example

<script runat=server>
     Platform.Response.SetCookie("cookieName","cookieValue","2015-12-31T14:00:00.999Z",true);
</script>