JSPM

  • Created
  • Published
  • Downloads 8523
  • Score
    100M100P100Q127334F
  • License MIT

Official Amplitude SDK for Web analytics, experiment, session replay, and more.

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, Guides and Surveys, 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/unified

Usage

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
  },

  // Guides and Surveys options
  engagement: {
    // Guides and Surveys 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();

// Access Guides and Surveys features via engagement global
const activeGuidesAndSurveys = await engagement.gs.list();

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.

Guides and Surveys Options

All options from @amplitude/engagement-browser are supported. See the Guides and Surveys documentation for details.

Learn More