- Functions
init (deprecated)
Version:
Warning
Deprecated. Use the core package to initialize the Cloud SDK and its packages. See also install and initialize the Cloud SDK.
| Type | Function |
| Import path | @sitecore-cloudsdk/personalize/server |
Initializes the server module of the Cloud SDK personalize package.
Important
Run init before running other functions in the module.
Signature
Parameters
| Name | Type | Description |
|---|---|---|
request | Request | Required. The HTTP request. |
response | Response | Required. The HTTP response. |
settings | ServerSettings | Required. Details about your SitecoreAI instance and cookie settings. |
ServerSettings properties
ServerSettings properties| Name | Type | Description | Value |
|---|---|---|---|
| sitecoreEdgeContextId | string | Required.Context ID.Accessible and stored as an environment variable in your app. | "3axQRoRznWUqHR8B2RSbdo" |
| siteName | string | Required.The name of the site.Accessible and stored as an environment variable in your app. | "myRetailSite" |
| cookieDomain | string | Optional.The top-level domain of your app. The cookie domain ensures that the Cloud SDK stores cookies in the web browser as first-party cookies.ImportantSet the same value for this property in every Cloud SDK module.Default: your domain. | ".myretailsite.com"".beta.myretailsite.com""localhost" |
| cookieExpiryDays | integer | Optional.The number of days before cookies expire.ImportantSet the same value for this property in every Cloud SDK module.For example, set to 1 for cookies to expire in 1 day.If unset, cookies expire according to the Max-Age set by the web browser. | 365 |
| cookiePath | string | Optional.A URL path that must exist in the requested URL in order to send cookies.ImportantSet the same value for this property in every Cloud SDK module.Default: "/". | "/" |
| enableServerCookie | boolean | Optional.Flag to set cookies from the server side.If using only the server modules of packages, set to true.If using both the browser and the server modules of packages, set either enableBrowserCookie or enableServerCookie to true, and set the other to false.Default: false. | true |
Return value
Returns a promise. The promise resolves with an object that handles the module functionality.
Examples
Here's an example middleware.ts script showing how to initialize the module:
If you have suggestions for improving this article, let us know!