Browser Unified SDK

The Unified SDK provides a single entry point for all Amplitude features, including Analytics, Experiment, and Session Replay. It simplifies the integration process by handling the initialization and configuration of all components.

Beta Release

The Browser Unified SDK is currently in beta. There may be breaking changes before the stable release. Amplitude recommends testing thoroughly in a development environment before you deploy to production.

Individual Product Installation

The Unified SDK installs Analytics, Experiment, and Session Replay. If you're concerned about bundle size and only need specific products, you can install them individually:

The Unified SDK doesn't support Guides and Surveys. If you need Guides and Surveys functionality, use the Guides and Surveys SDK directly.

Install the SDK

Install the dependency with npm or yarn.

npm install @amplitude/unified

yarn add @amplitude/unified

Initialize the SDK

The Unified SDK provides a single initialization method that initializes all Amplitude features.

import { initAll } from '@amplitude/unified';
 
initAll('YOUR_API_KEY');

Access SDK features

The Unified SDK provides access to all Amplitude features through a single interface:

Feature Documentation

For detailed information about each product's features and APIs, refer to their respective documentation:

import {
track,
identify,
experiment,
sessionReplay
} from '@amplitude/unified';
 
// Track events
track('Button Clicked', { buttonName: 'Sign Up' });
 
// Identify users
identify(new Identify().set('userType', 'premium'));
 
// Access Experiment features
const variant = await experiment.fetch('experiment-key');
 
// Access Session Replay features
sessionReplay.flush();

Configuration

The Unified SDK supports configuration options for all Amplitude features. You can configure each product individually while sharing some common options.

import { initAll } from '@amplitude/unified';
 
initAll('YOUR_API_KEY', {
// Shared options for all SDKs (optional)
serverZone: 'US', // or 'EU'
instanceName: 'my-instance',
 
// Analytics options
analytics: {
// Analytics configuration options
},
 
// Session Replay options
sessionReplay: {
// Session Replay configuration options
sampleRate: 1 // To enable session replay
},
 
// Experiment options
experiment: {
// Experiment configuration options
}
});

Shared options

Name Type Default Description
serverZone 'US' or 'EU' 'US' The server zone to use for all SDKs.
instanceName string $default_instance A unique name for this instance of the SDK.

Analytics options

All options from @amplitude/analytics-browser are supported. See the Analytics Browser SDK documentation for details.

Session Replay options

The Unified Browser SDK supports all options from @amplitude/plugin-session-replay-browser. See the Session Replay Plugin documentation for more information. Set config.sessionReplay.sampleRate to a non-zero value to enable session replay.

Sample Rate controls the rate at which Amplitude captures session replays. For example, if you set config.sessionReplay.sampleRate to 0.5, Session Replay captures roughly half of all sessions.

Experiment options

All options from @amplitude/plugin-experiment-browser are supported. See the Experiment documentation for details.

Was this page helpful?

May 30th, 2025

Need help? Contact Support

Visit Amplitude.com

Have a look at the Amplitude Blog

Learn more at Amplitude Academy

© 2025 Amplitude, Inc. All rights reserved. Amplitude is a registered trademark of Amplitude, Inc.