# @amplitude/analytics-browser

> Official Amplitude SDK for Web

Latest version **2.47.2** (published 2026-09-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @amplitude/analytics-browser
pnpm add @amplitude/analytics-browser
yarn add @amplitude/analytics-browser
bun add @amplitude/analytics-browser
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.47.2 |
| Published | 2026-09-29 |
| First published | 2022-03-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 9 |
| Unpacked size | 3.9 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 181 |
| Author | Amplitude Inc |
| Maintainers | curtisbliu, kelson.warner, sdk.dev, eric_amplitude, daniel-graham-amplitude, jjwang123 |
| Keywords | analytics, amplitude |

## Links

- npm: https://www.npmjs.com/package/@amplitude/analytics-browser
- Repository: https://github.com/amplitude/Amplitude-TypeScript
- Issues: https://github.com/amplitude/Amplitude-TypeScript/issues
- npm.io page: https://npm.io/package/@amplitude/analytics-browser

## Dependencies (9)

- [tslib](https://npm.io/package/tslib.md) ^2.4.1
- [@amplitude/analytics-core](https://npm.io/package/@amplitude/analytics-core.md) 2.59.0
- [@amplitude/plugin-web-vitals-browser](https://npm.io/package/@amplitude/plugin-web-vitals-browser.md) 1.2.2
- [@amplitude/plugin-autocapture-browser](https://npm.io/package/@amplitude/plugin-autocapture-browser.md) 1.29.5
- [@amplitude/plugin-network-capture-browser](https://npm.io/package/@amplitude/plugin-network-capture-browser.md) 1.10.19
- [@amplitude/plugin-custom-enrichment-browser](https://npm.io/package/@amplitude/plugin-custom-enrichment-browser.md) 0.1.22
- [@amplitude/plugin-page-view-tracking-browser](https://npm.io/package/@amplitude/plugin-page-view-tracking-browser.md) 2.11.19
- [@amplitude/plugin-page-url-enrichment-browser](https://npm.io/package/@amplitude/plugin-page-url-enrichment-browser.md) 0.7.29
- [@amplitude/plugin-event-property-attribution-browser](https://npm.io/package/@amplitude/plugin-event-property-attribution-browser.md) 0.2.19

## Recent versions

- 2.47.2 (latest) — 2026-09-29
- 2.47.0-video-analytics-5.0 (video-analytics-5) — 2026-09-22
- 2.46.0-video-analytics-4.0 (video-analytics-4) — 2026-09-17
- 2.46.0-video-analytics-2.0 (video-analytics-2) — 2026-09-09
- 2.46.0-video-analytics.0 (video-analytics) — 2026-07-31
- 2.44.2-element-path-v1.0 (element-path-v1) — 2026-06-23
- 2.44.2-featelement-selector-v1.0 (featelement-selector-v1) — 2026-06-15
- 2.43.1-SR-4497-custom-transport-hooks.0 (SR-4497-custom-transport-hooks) — 2026-06-09
- 2.43.0-sr-perf-reliability-rc.0 (sr-perf-reliability-rc) — 2026-06-05
- 2.43.0-sr-4646-rc.0 (sr-4646-rc) — 2026-06-03
- 2.42.1-sr-idb-multitab-test-rc.0 (sr-idb-multitab-test-rc) — 2026-05-04
- 2.41.0-sr-3531-rc-2.0 (sr-3531-rc-2) — 2026-04-20
- 2.38.2-SR-3115-rc2.0 (SR-3115-rc2) — 2026-04-08
- 2.38.2-SR-3115-rc1.0 (SR-3115-rc1) — 2026-04-03
- 2.38.2-SR-3115.0 (SR-3115) — 2026-04-03
- … 325 more at https://npm.io/package/@amplitude/analytics-browser/versions

## README

<p align="center">
  <a href="https://amplitude.com" target="_blank" align="center">
    <img src="https://static.amplitude.com/lightning/46c85bfd91905de8047f1ee65c7c93d6fa9ee6ea/static/media/amplitude-logo-with-text.4fb9e463.svg" width="280">
  </a>
  <br />
</p>

# @amplitude/analytics-browser

Official Amplitude SDK for Web

# Doc

See our [Analytics SDK for Browser](https://amplitude.github.io/Amplitude-TypeScript/modules/_amplitude_analytics_browser.html) Reference for a list and description of all available SDK methods.

# Installation and Quick Start

Please visit our :100:[Developer Center](https://www.docs.developers.amplitude.com/data/sdks/browser-2/) for instructions on installing and using our the SDK.

## Installation

To get started with using Amplitude Browser SDK, install the package to your project via npm, yarn or script loader.

### Installing via package manager

This SDK is available as a package on npm registry named `@amplitude/analytics-browser`. You can install the package using npm or yarn CLI.

#### Using npm CLI

```sh
npm install @amplitude/analytics-browser
```

#### Using yarn CLI

```sh
# yarn
yarn add @amplitude/analytics-browser
```

Import the package into your project and initialize it with your API key.

```ts
import * as amplitude from '@amplitude/analytics-browser';

amplitude.init('<YOUR_API_KEY>');
```

### Installing via script loader

This SDK is also available through CDN. Copy the script loader below and paste before the `</head>` tag of every page you want to track and initialize it with your API key.

<!-- README_SNIPPET_BLOCK -->
```html
<script type="text/javascript">
!function(){"use strict";!function(e,t){var r=e.amplitude||{_q:[],_iq:{}};if(r.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var n=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},s=function(e,t,r){return function(n){e._q.push({name:t,args:Array.prototype.slice.call(r,0),resolve:n})}},o=function(e,t,r){e[t]=function(){if(r)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))};!function(e,t,r){e._q.push({name:t,args:Array.prototype.slice.call(r,0)})}(e,t,Array.prototype.slice.call(arguments))}},i=function(e){for(var t=0;t<v.length;t++)o(e,v[t],!1);for(var r=0;r<g.length;r++)o(e,g[r],!0)};r.invoked=!0;var a=t.createElement("script");a.type="text/javascript",a.integrity="sha384-RTQybE5H4H6uCtC3gXx2Y7xeDTADZHEZf8qf6y0WeZbtGGVNpYEailMtUOgAA93+",a.crossOrigin="anonymous",a.async=!0,a.src="https://cdn.amplitude.com/libs/analytics-browser-2.47.2-min.js.gz",a.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var c=t.getElementsByTagName("script")[0];c.parentNode.insertBefore(a,c);for(var u=function(){return this._q=[],this},p=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],l=0;l<p.length;l++)n(u,p[l]);r.Identify=u;for(var d=function(){return this._q=[],this},f=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setReceipt","setReceiptSig","setCurrency","setEventProperties"],y=0;y<f.length;y++)n(d,f[y]);r.Revenue=d;var v=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],g=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];i(r),r.createInstance=function(e){return r._iq[e]={_q:[]},i(r._iq[e]),r._iq[e]},e.amplitude=r}}(window,document)}();

amplitude.init("<YOUR_API_KEY>");
</script>
```
<!-- / OF README_SNIPPET_BLOCK -->

## Tracking events

Once the SDK is initialize, you can start tracking events.

```ts
amplitude.track('Page Viewed');
```

For in-depth documentation, please visit to our [Developer Center](https://www.docs.developers.amplitude.com/data/sdks/sdk-quickstart/#browser).

---
_Source: https://npm.io/package/@amplitude/analytics-browser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
