---
title: Browser Unified SDK reference
description: "Every public export and initAll() option in the Amplitude Browser Unified SDK, verified against version 1.1.43, which bundles Browser SDK 2.48.1."
product: analytics
lang: en
last_updated: 2026-10-29
token_estimate: 2211
---
# Browser Unified SDK reference

> For AI agents: a documentation index is available at [/docs/llms.txt](/docs/llms.txt). Append `.md` to any page URL for markdown, or send `Accept: text/markdown`.

This reference documents every public export of `@amplitude/unified` and every option you can pass to `initAll()`, verified against version 1.1.43. That version bundles Browser SDK 2.48.1 (`@amplitude/analytics-browser`), so every analytics method behaves as the [Browser SDK 2 reference](https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2/reference) describes. For changes between versions, go to the [`@amplitude/unified` changelog](https://github.com/amplitude/Amplitude-TypeScript/blob/main/packages/unified/CHANGELOG.md).

```ts
import * as amplitude from "@amplitude/unified";
```

The top-level functions act on a default instance. Each instance from [`createInstance()`](#createinstance) has the same methods, plus `init()`.

## Exports

| Export | Description |
| --- | --- |
| [`initAll`](#initall), [`experiment`](#experiment), [`sessionReplay`](#sessionreplay), [`createInstance`](#createinstance) | Specific to the Unified SDK. Documented on this page. |
| `track`, `logEvent`, `identify`, `groupIdentify`, `setGroup`, `revenue`, `flush`, `add`, `remove`, `setTransport`, `getUserId`, `setUserId`, `getDeviceId`, `setDeviceId`, `getIdentity`, `setIdentity`, `getSessionId`, `setSessionId`, `extendSession`, `reset`, `getOptOut`, `setOptOut` | The Browser SDK 2 methods. Go to the [Browser SDK 2 reference](https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2/reference). |
| `Identify`, `Revenue`, `Types` | Re-exported from Browser SDK 2. Go to [Identify](https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2/reference#identify), [Revenue](https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2/reference#revenue), and [Types](https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2/reference#types). |
| `UnifiedOptions`, `UnifiedSharedOptions`, `UnifiedClient` | TypeScript types only, with no runtime value. Go to [UnifiedOptions](#unifiedoptions) and [UnifiedClient](#unifiedclient). |

The top-level module doesn't export `init()`. Call `initAll()` instead.

## Setup

### initAll

Initializes Analytics, then adds Session Replay, Feature Experiment, and Guides and Surveys. Call it once per instance on each page load.

```ts
initAll(apiKey: string, unifiedOptions?: UnifiedOptions): Promise<void>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `apiKey` | `string` | Your Amplitude project API key. |
| `unifiedOptions` | `UnifiedOptions` | Optional. Go to [UnifiedOptions](#unifiedoptions). |

`initAll()` returns a plain `Promise`, not an `AmplitudeReturn`, so await it directly. It resolves after every product finishes setup. Calls made before it resolves wait in a queue and run in order afterward.

An `initAll()` call made while an earlier call is still pending returns the same promise. An `initAll()` call made after the earlier call resolves runs the full setup again. The repeat call initializes Analytics again, tracks another page view if page view tracking is on, and restarts Session Replay. It also logs `Plugin with name @amplitude/unified-library-plugin already exists, skipping registration`.

```ts
await amplitude.initAll("YOUR_API_KEY", {
  serverZone: "EU",
  sessionReplay: { sampleRate: 0.1 },
});
```

### experiment

Returns the Feature Experiment client, or `undefined` before `initAll()` adds it.

```ts
experiment(): IExperimentClient | undefined
```

The client is the [Experiment JavaScript SDK](https://amplitude.com/docs/sdks/experiment-sdks/experiment-javascript) client. The client doesn't fetch flags during `initAll()`. Call `fetch()` before `variant()`.

```ts
const experiment = amplitude.experiment();
await experiment?.fetch();
const variant = experiment?.variant("checkout-redesign");
```

### sessionReplay

Returns the Session Replay client, or `undefined` before `initAll()` adds it.

```ts
sessionReplay(): AmplitudeSessionReplay | undefined
```

| Method | Description |
| --- | --- |
| `start(): AmplitudeReturn<void>` | Starts or resumes recording. Recording still respects sample rate, targeting, opt-out, and remote capture settings. |
| `stop(): void` | Pauses recording without tearing down the SDK. Call `start()` to resume. |
| `shutdown(): void` | Stops recording and removes event listeners. |
| `flush(useRetry: boolean): Promise<void>` | Uploads recorded data now. Pass `true` to retry failed uploads. |
| `getSessionReplayProperties(): { [key: string]: boolean | string | null }` | Returns `{ "[Amplitude] Session Replay ID": "..." }` while Session Replay records the session, and `{}` otherwise. |
| `getSessionId(): string | number | undefined` | Returns the session ID that Session Replay records against. |
| `setSessionId(sessionId: string | number, deviceId?: string): AmplitudeReturn<void>` | Sets the session ID that Session Replay records against. |
| `init`, `evaluateTargetingAndCapture` | The plugin calls these during setup. Don't call them directly. |

```ts
const replay = amplitude.sessionReplay();
replay?.stop();
```

For recording options, go to [Session Replay plugin](https://amplitude.com/docs/sdks/session-replay/session-replay-plugin).

### createInstance

Creates an independent instance with its own Analytics configuration, identity, queue, and plugins.

```ts
createInstance(): UnifiedClient
```

```ts
const marketing = amplitude.createInstance();
await marketing.initAll("MARKETING_API_KEY", { instanceName: "marketing" });
marketing.track("Signup Completed");
```

Guides and Surveys initializes once per page. Instances that call `initAll()` after the first instance ignore their `engagement` options.

## UnifiedClient

The interface that the default instance implements and `createInstance()` returns. It extends the Browser SDK 2 `BrowserClient` with these members:

| Member | Description |
| --- | --- |
| `initAll` | Refer to [initAll](#initall). |
| `experiment` | Refer to [experiment](#experiment). |
| `sessionReplay` | Refer to [sessionReplay](#sessionreplay). |
| `init` | Initializes Analytics only, as [Browser SDK 2 `init()`](https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2/reference#init) does. Available on instances from `createInstance()`, not as a top-level export. |

## UnifiedOptions

The options object you pass to `initAll()`. All options are optional.

### Shared options

`initAll()` passes these options to every product and merges them over the same-named option in each product block. An unset shared option still overwrites the same-named product option with `undefined`.

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `serverZone` | `"US"` or `"EU"` | `"US"` | The data center for every product. Set it here, not in `analytics`. |
| `instanceName` | `string` | `"$default_instance"` | The instance name for every product. Use a distinct name for each instance from `createInstance()`. |

### Product options

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `analytics` | `BrowserOptions` | `{}` | Browser SDK 2 options. Go to [Configuration options](https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2/reference#configuration-options). |
| `sessionReplay` | `SessionReplayOptions`, without the shared options | `{}` | Session Replay plugin options. `sampleRate` defaults to `0`, which records nothing. Go to [Session Replay plugin](https://amplitude.com/docs/sdks/session-replay/session-replay-plugin#configuration). |
| `experiment` | `ExperimentPluginConfig`, without the shared options | `{}` | Experiment JavaScript SDK options, plus `deploymentKey`. Go to [experiment options](#experiment-options). |
| `engagement` | Guides and Surveys `InitOptions`, without the shared options | `{}` | Guides and Surveys options, plus `skip`. Go to [engagement options](#engagement-options). |

#### experiment options

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `deploymentKey` | `string` | The project API key | The Experiment client deployment key. |
| Other options | Varies | Varies | Every [Experiment JavaScript SDK option](https://amplitude.com/docs/sdks/experiment-sdks/experiment-javascript#configuration). Version 1.1.43 includes `@amplitude/plugin-experiment-browser` 1.0.0-beta.51, a beta release. |

#### engagement options

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `skip` | `boolean` | `false` | When `true`, Guides and Surveys downloads nothing, makes no requests, and writes nothing to storage. Requires `@amplitude/unified` 1.1.11 or later. |
| Other options | Varies | Varies | Every [Guides and Surveys option](https://amplitude.com/docs/sdks/guides-and-surveys/sdk#initialize-the-sdk). |

