The Unified SDK provides a single entry point for all Amplitude features, including Analytics, Experiment, Session Replay, and Guides and Surveys. It simplifies the integration process by handling the initialization and configuration of all components.
Install the dependency with npm or yarn.
npm install @amplitude/unified
yarn add @amplitude/unified
Click the Key icon to insert your Amplitude API key.
You are an Amplitude Analytics installation wizard, an expert AI programming assistant that implements Amplitude Analytics and Session Replay for JavaScript-based applications.
Your task is to select, install, and initialize the correct Amplitude package(s) necessary to enable Amplitude Analytics and Session Replay for this application and track key interactions, all in strict accordance to the Documentation provided below.
Rules
- Do not make any code changes if this is not a JavaScript-based application
- Ensure ALL the code added ONLY runs client-side and never server-side
- Ensure amplitude is only initialized once during the lifecycle of the application
Context
---
## Documentation
1. Install the Amplitude Analytics Browser SDK with `npm install @amplitude/unified` or `yarn add @amplitude/unified`
2. Import amplitude into the root of the client application with `import * as amplitude from '@amplitude/unified';`
3. Initialize amplitude with `amplitude.initAll('AMPLITUDE_API_KEY', {"analytics":{"autocapture":true},"sessionReplay":{"sampleRate":1}});`
<head> of your site to track engagement.
Click the Key icon to insert your Amplitude API key.
<script src="https://cdn.amplitude.com/script/AMPLITUDE_API_KEY.js"></script><script>window.amplitude.add(window.sessionReplay.plugin({sampleRate: 1}));window.amplitude.init('AMPLITUDE_API_KEY', {"fetchRemoteConfig":true,"autocapture":{"attribution":true,"fileDownloads":true,"formInteractions":true,"pageViews":true,"sessions":true,"elementInteractions":true,"networkTracking":true,"webVitals":true,"frustrationInteractions":true}});</script>
The Unified SDK provides a single initialization method that initializes all Amplitude features.
import { initAll } from '@amplitude/unified';
initAll('AMPLITUDE_API_KEY');
The Unified SDK provides access to all Amplitude features through a single interface:
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();
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('AMPLITUDE_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
},
// Guides and Surveys options
engagement: {
// Guides and Surveys configuration 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. |
All options from @amplitude/analytics-browser are supported. See the Analytics Browser SDK documentation for details.
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.
All options from @amplitude/plugin-experiment-browser are supported. See the Experiment documentation for details.
The Unified Browser SDK supports all Guides and Surveys options. The engagement plugin initializes automatically when you pass engagement options in the configuration.
December 11th, 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.