# @amplitude/identify

> Utility functions to build and interact with the Identify API

Latest version **1.10.2** (published 2022-09-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install @amplitude/identify
pnpm add @amplitude/identify
yarn add @amplitude/identify
bun add @amplitude/identify
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.10.2 |
| Published | 2022-09-08 |
| First published | 2021-01-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 3 |
| Unpacked size | 54.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 73 |
| Author | Amplitude Inc |
| Maintainers | mae.capozzi, sdk.dev, dnshi, kevinpagtakhan, justin-fiedler, qingzhuo, rctbusk, manthursday, jackmccloy, amp_haoliu, myztiq, curtisbliu, jtran, kelvin-lu, nutwani, hao.yu, kelson.warner, ajhorst_amp, brian.giori |

## Links

- npm: https://www.npmjs.com/package/@amplitude/identify
- Repository: https://github.com/amplitude/Amplitude-Node
- Homepage: https://github.com/amplitude/Amplitude-Node/tree/master/packages/identify
- Issues: https://github.com/amplitude/Amplitude-Node/issues
- npm.io page: https://npm.io/package/@amplitude/identify

## Dependencies (3)

- [tslib](https://npm.io/package/tslib.md) ^2.0.0
- [@amplitude/types](https://npm.io/package/@amplitude/types.md) ^1.10.2
- [@amplitude/utils](https://npm.io/package/@amplitude/utils.md) ^1.10.2

## Recent versions

- 1.10.2 (latest) — 2022-09-08
- 1.10.1 — 2022-08-29
- 1.10.0 — 2022-03-31
- 1.9.2 — 2022-01-31
- 1.9.1 — 2021-11-11
- 1.9.0 — 2021-10-15
- 1.8.4 — 2021-09-22
- 1.8.2 — 2021-08-25
- 1.8.1 — 2021-08-20
- 1.8.0 — 2021-07-27
- 1.7.0 — 2021-06-25
- 1.6.1 — 2021-05-25
- 1.6.0 — 2021-05-20
- 1.5.5 — 2021-05-12
- 1.5.4 — 2021-04-12
- … 8 more at https://npm.io/package/@amplitude/identify/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>

[![npm version](https://badge.fury.io/js/%40amplitude%2Fidentify.svg)](https://badge.fury.io/js/%40amplitude%2Fidentify)

# General

Utility functions to build and interact with the [Identify API](https://developers.amplitude.com/docs/identify-api) with the Node SDK.
This is a builder library to help interface with creating Identify events.
These events help add user properties to users and devices in your analytics, and do not count towards the event volume.

To use this, create an Identify instance and use the provided functions to set properties, chaining along function calls:

```
import { Identify } from '@amplitude/identify'

const identify = new Identify();
identify
  .set('start_date', 'March 3rd')
  .add('num_clicks', 4)
  .unset('needs_to_activate')
```

Then, this can be used with the Node SDK to send an identify call.
Because identify calls are special events, there are two different ways to accomplish this:

```
import Amplitude from '@amplitude/node';

const client = Amplitude.init('YOUR_API_KEY');

// One way to call the identify
client.identify('USER_ID', 'DEVICE_ID', identify);
// Equivalent way to call identify
// Can also modify the identifyEvent directly here
const identifyEvent = identify.identifyUser('USER_ID', 'DEVICE_ID');
client.logEvent(identifyEvent);
```
## Compatibility with Amplitude-Javascript

This is **not** compatible with the Amplitude Javascript SDK (`amplitude-js`).
This package should not be used with that SDK, and the identify API provided there should **not** be used with the Node SDK.
There are plans to consolidate these incompatibilities
.
## Group Identify

This identify supports the `setGroup` function.
Any identify operation calls made on this object will **also** be treated as a group identify call.
Certain operations will not be transferred to the group properties (see the docs on the [Group Identify API](https://developers.amplitude.com/docs/group-identify-api) to see which properties are supported here).

To not associate a user with the group identify, you can also use the `identifyGroup` function to send `$groupIdentify`
events for a group.

## Clear All

Clear all will clear all user properties from the user and device on all events going forward.
**Use this carefully** and make sure this is something you want to do instead of creating a new user/device id.
When clear all is used on the identify builder, all other operations are canceled and no new operations can be added.
This is because clear all must be sent as its own identify object.

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