identify() / group()
Attach human identity to users and accounts so answers read "Kari at Acme".
identify() and group() are how you attach human-readable identity to the
opaque IDs Atune already sees in behavior. Everything else works without them —
identity just makes answers legible.
import { identify, group } from "atune";
await identify("u_123", { name: "Kari Nordmann", email: "kari@acme.no" }, { accountId: "acme" });
await group("acme", { company: "Acme AS" });So answers read "Kari at Acme", not "user u_123".
identify(userId, traits, options)
Associates a user with human traits. Pass options.accountId to match the
account used by capture; otherwise the SDK falls back to userId as the
account ID, so a user without an account becomes an account of one (the B2C
case). If that user later appears in a real account, Atune removes the
account of one as long as it never received an event, and keeps the user's
traits. group() does not set a global account for later identify calls.
| Argument | Type | Notes |
|---|---|---|
userId | string | Your own user identifier. |
traits | object | Personal data such as name, email. |
group(accountId, traits)
Associates an account (team / org / tenant) with traits.
| Argument | Type | Notes |
|---|---|---|
accountId | string | Your own account identifier. |
traits | object | Account traits such as company. |
Unlike track() and the middleware, identify() and group() reject on a
network error or timeout. Catch the error if the call must not fail the caller,
or let it fail so a webhook retries it.
Gated behind your DPA
identify() and group() carry personal data, so they flow only under an
accepted data-processing agreement. See
Identity, PII & the DPA.