- 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/events/browser |
Initializes the browser module of the Cloud SDK events package.
Important
Run init before running other functions in the module.
Signature
Parameters
| Name | Type | Description |
|---|---|---|
settings | BrowserSettings | Required. Details about your SitecoreAI instance and cookie settings. |
BrowserSettings properties
BrowserSettings 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.Default: your domain. | ".myretailsite.com"".beta.myretailsite.com""localhost" |
| cookieExpiryDays | integer | Optional.The number of days before cookies expire.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.Default: "/". | "/" |
| enableBrowserCookie | boolean | Optional.Flag to set cookies from the browser side.If using only the browser 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.
Examples
Here's an example page.tsx script showing how to initialize the module:
If you have suggestions for improving this article, let us know!