---
title: "init (deprecated)"
slug: "cloud-sdk-events-browser-init"
abstract: "The init function initializes the browser module of the Cloud SDK events package. Run init before running other functions in the module."
---
# init (deprecated)

> [!warning]
> Deprecated. Use the [`core`](https://doc.sitecore.com/sdk/en/developers/004/cloud-sdk/cloud-sdk-reference/cloud-sdk-events/cloud-sdk-events-browser/functions/cloud-sdk-core.html "@sitecore-cloudsdk/core") package to initialize the Cloud SDK and its packages. See also [install and initialize the Cloud SDK](https://doc.sitecore.com/sdk/en/developers/004/cloud-sdk/cloud-sdk-reference/cloud-sdk-events/cloud-sdk-events-browser/functions/install-and-initialize-the-cloud-sdk.html "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

```typescript
export async function init(
  settings: BrowserSettings
): Promise<void>
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `settings` | [`BrowserSettings`](https://doc.sitecore.com/sdk/en/developers/004/cloud-sdk/cloud-sdk-reference/cloud-sdk-events/cloud-sdk-events-browser/functions/cloud-sdk-events-browser-init.html#UUID-a30cc2fe-f8fd-66fd-abf1-24c36db73600_section-idm234400073351417 "BrowserSettings properties") | Required.<br><br>Details about your SitecoreAI instance and cookie settings. |

### `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

:::tab{title="Next.js"}
Here's an example `page.tsx` script showing how to initialize the module:

```typescript
"use client";
import { useEffect } from "react";
import { init } from "@sitecore-cloudsdk/events/browser";

export default function Home() {
  // Initialize the module ->
  useEffect(() => {
    initEvents();
  }, []);

  const initEvents = async () => {
    await init({
      sitecoreEdgeContextId: process.env.SITECORE_EDGE_CONTEXT_ID,
      siteName: process.env.SITECORE_SITE_NAME,
      enableBrowserCookie: true
    });

    console.log("Initialized the events/browser module.");
  };
  // <- Initialize the module

  return (<></>);
};
```

:::