Package Exports
- @amplitude/unified
- @amplitude/unified/lib/cjs/index.js
- @amplitude/unified/lib/esm/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@amplitude/unified) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@amplitude/unified
Official Amplitude SDK for Web analytics, experiment, session replay, and more.
Installation
This package is published on NPM registry and is available to be installed using npm and yarn.
# npm
npm install @amplitude/unified
# yarn
yarn add @amplitude/unifiedUsage
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.
1. Import Amplitude Unified SDK
import { initAll } from '@amplitude/unified';2. Initialize the SDK
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
},
// Experiment options
experiment: {
// Experiment configuration options
}
});3. Access SDK Features
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();Configuration Options
Shared Options
| Name | Type | Default | Description |
|---|---|---|---|
serverZone |
'US' or 'EU' |
'US' |
The server zone to use for all SDKs. |
instanceName |
string |
undefined |
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
All options from @amplitude/plugin-session-replay-browser are supported. See the Session Replay documentation for details.
Experiment Options
All options from @amplitude/plugin-experiment-browser are supported. See the Experiment documentation for details.