Skip to main content
Users
CloudPortalLogin
  • Powered byPowered by
Developing with Sitecore Personalize
Data privacy
Before you start sending data
Integrating with Sitecore Personalize
Stream API
Personalize API Flow execution
REST APIs
  • Sitecore Personalize for developers
  • Stream API
  • Boxever JavaScript Library (legacy) reference
  • Functions
  • Boxever.setCookie(cookieName, cookieValue[, expiresIn])

Boxever.setCookie(cookieName, cookieValue[, expiresIn])

The setCookie() function creates a cookie in the browser.

Parameters

Parameter

Type

Description

Note

cookieName

string or number

The name of the cookie.

N/A

cookieValue

string

The value of the cookie.

N/A

[expiresIn]

optional

integer

The number of days before the cookie expires.

If you do not specify this value, the cookie becomes a session cookie.

For example, set the value to 1 for the cookie to expire in 1 day.

Return value

undefined

Example

Create a cookie in the browser that expires in 1 day:

RequestResponse
Boxever.setCookie("_example_cookie_name_", "_example_cookie_value_", 1);

Do you have some feedback for us?

If you have suggestions for improving this article,

Privacy policySitecore Trust CenterCopyright © 1999-2026 Sitecore