# @amplitude/analytics-node

> Official Amplitude SDK for NodeJS

Latest version **1.5.71** (published 2026-08-24) · MIT license · 0 weekly downloads

## Install

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

## 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 | 1.5.71 |
| Published | 2026-08-24 |
| First published | 2022-07-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 88.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 180 |
| Author | Amplitude Inc |
| Maintainers | curtisbliu, kelson.warner, sdk.dev, eric_amplitude, daniel-graham-amplitude, jjwang123 |

## Links

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

## Dependencies (2)

- [tslib](https://npm.io/package/tslib.md) ^2.4.1
- [@amplitude/analytics-core](https://npm.io/package/@amplitude/analytics-core.md) 2.55.0

## Recent versions

- 1.5.71 (latest) — 2026-08-24
- 1.6.0-video-analytics-2.0 (video-analytics-2) — 2026-09-09
- 1.6.0-video-analytics.0 (video-analytics) — 2026-07-31
- 1.5.61-featelement-selector-v1.0 (featelement-selector-v1) — 2026-06-15
- 1.5.60-SR-4497-custom-transport-hooks.0 (SR-4497-custom-transport-hooks) — 2026-06-09
- 1.5.59-sr-perf-reliability-rc.0 (sr-perf-reliability-rc) — 2026-06-05
- 1.5.59-sr-4646-rc.0 (sr-4646-rc) — 2026-06-03
- 1.5.58-sr-idb-multitab-test-rc.0 (sr-idb-multitab-test-rc) — 2026-05-04
- 1.5.55-sr-3531-rc-2.0 (sr-3531-rc-2) — 2026-04-20
- 1.5.53-SR-3115-rc2.0 (SR-3115-rc2) — 2026-04-08
- 1.5.53-SR-3115-rc1.0 (SR-3115-rc1) — 2026-04-03
- 1.5.53-SR-3115.0 (SR-3115) — 2026-04-03
- 1.5.44-SR-2728.0 (SR-2728) — 2026-03-12
- 1.5.35-feat-zoning-alpha.0 (feat-zoning-alpha) — 2026-02-03
- 1.5.30-SR-2360.0 (SR-2360) — 2026-01-21
- … 133 more at https://npm.io/package/@amplitude/analytics-node/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-node

Official Amplitude SDK for Node.js

# Doc

See our [Typescript Analytics Node SDK](https://amplitude.github.io/Amplitude-TypeScript/modules/_amplitude_analytics_node.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/typescript-node/) for instructions on installing and using our the SDK.

## Installation

To get started with using Amplitude Node.js SDK, install the package to your project via NPM.

### Using Node package

This package is published on NPM registry and is available to be installed using npm and yarn.

```sh
# npm
npm install @amplitude/analytics-node@^1.0.0

# yarn
yarn add @amplitude/analytics-node@^1.0.0
```

## Usage

### Initializing SDK

Initialization is necessary before any instrumentation is done. The API key for your Amplitude project is required.

```typescript
amplitude.init(API_KEY);
```

### Tracking an Event

Events represent how users interact with your application. For example, "Button Clicked" may be an action you want to note.

```typescript
import { track } from '@amplitude/analytics-node';

// Track a basic event
track('Button Clicked', undefined, {
  user_id: 'user@amplitude.com',
});

// Track events with additional properties
const eventProperties = {
  selectedColors: ['red', 'blue'],
};
track('Button Clicked', eventProperties, {
  user_id: 'user@amplitude.com',
});
```

### User Properties

User properties help you understand your users at the time they performed some action within your app such as their device details, their preferences, or language.

```typescript
import { Identify, identify } from '@amplitude/analytics-node';

const event = new Identify();

// sets the value of a user property
event.set('key1', 'value1');

// sets the value of a user property only once
event.setOnce('key1', 'value1');

// increments a user property by some numerical value.
event.add('value1', 10);

// pre inserts a value or values to a user property
event.preInsert('ab-tests', 'new-user-test');

// post inserts a value or values to a user property
event.postInsert('ab-tests', 'new-user-test');

// removes a value or values to a user property
event.remove('ab-tests', 'new-user-test')

// sends identify event
identify(event);
```

### prepend/append

* append will append a value or values to a user property array.
* prepend will prepend a value or values to a user property.

### User Groups

```typescript
import { setGroup } from '@amplitude/analytics-node';

// set group with single group name
setGroup('orgId', '15');

// set group with multiple group names
setGroup('sport', ['soccer', 'tennis']);
```

### Group Identify

This feature is only available to Growth and Enterprise customers who have purchased the [Accounts add-on](https://amplitude.zendesk.com/hc/en-us/articles/115001765532).

Use the Group Identify API to set or update properties of particular groups. However, these updates will only affect events going forward.

```typescript
import { Identify, groupIdentify } from '@amplitude/analytics-node';

const groupType = 'plan';
const groupName = 'enterprise';
const identity = new Identify()
identity.set('key1', 'value1');

groupIdentify(groupType, groupName, identity);
```

### Track Revenue

Revenue instances will store each revenue transaction and allow you to define several special revenue properties (such as 'revenueType', 'productIdentifier', etc.) that are used in Amplitude's Event Segmentation and Revenue LTV charts. These Revenue instance objects are then passed into `revenue` to send as revenue events to Amplitude. This allows us to automatically display data relevant to revenue in the platform. You can use this to track both in-app and non-in-app purchases.

```typescript
import { Revenue, revenue } from '@amplitude/analytics-node';

const event = new Revenue()
  .setProductId('com.company.productId')
  .setPrice(3.99)
  .setQuantity(3);

revenue(event);
```

### Callback

All asynchronous API are optionally awaitable through a specific Promise interface. This also serves as callback interface.

```typescript
// Using async/await
const results = await track('Button Clicked').promise;
result.event; // {...} (The final event object sent to Amplitude)
result.code; // 200 (The HTTP response status code of the request.
result.message; // "Event tracked successfully" (The response message)

// Using promises
track('Button Clicked').promise.then((result) => {
  result.event; // {...} (The final event object sent to Amplitude)
  result.code; // 200 (The HTTP response status code of the request.
  result.message; // "Event tracked successfully" (The response message)
});
```

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