---
title: Install the Browser Unified SDK with npm or yarn
description: "Install the Amplitude Browser Unified SDK in a bundled JavaScript app with npm or yarn, initialize it, and track your first event."
product: general
lang: en
last_updated: 2026-10-21
token_estimate: 448
---
# Install the Browser Unified SDK with npm or yarn

> 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`.

The Browser Unified SDK (`@amplitude/unified`) adds Amplitude to a JavaScript web app that uses a bundler. Install it with npm or yarn, call `initAll` once at app load, then call `track` to send events. If your site has no build step, use the [script snippet](https://amplitude.com/docs/get-started/install-with-snippet) instead.

## Prerequisites

- An Amplitude project and its API key. Create a [free Amplitude account](https://app.amplitude.com/signup) if you need one.
- A JavaScript web app that installs packages with npm or yarn.

## Install and initialize the SDK

1. **Install the Browser Unified SDK**

   Run one of these commands in your project directory. Choose the package manager your project already uses.

   #### npm

   ```bash
   npm install @amplitude/unified
   ```

   #### yarn

   ```bash
   yarn add @amplitude/unified
   ```
2. **Initialize Amplitude at app load**

   Import and call `initAll` once when your app starts:

   ```javascript
   import { initAll } from "@amplitude/unified";

   initAll("AMPLITUDE_API_KEY");
   ```
3. **Track your first event**

   Call `track` anywhere in your app:

   ```javascript
   import { track } from "@amplitude/unified";

   track("Button Clicked", { buttonId: "signup" });
   ```
4. **Confirm data in Amplitude**

   Open the [Amplitude Debugger](https://amplitude.com/docs/analytics/debug-analytics) and check that the `Button Clicked` event reaches your project.

For full configuration options, refer to [Browser Unified SDK](https://amplitude.com/docs/sdks/analytics/browser/browser-unified-sdk).

