Developer pages

Identify users

identifyUser, setUserProperty, logout — how identity attaches to sessions and Visitors.

When to call identify

After login (or whenever you know who the person is). Call again when traits change (plan, name, email).

API

The shipped signature accepts either a bare traits object or { userProperties }:

// Bare properties (common)
await tracker.identifyUser({
  email: "ada@example.com",
  name: "Ada Lovelace",
  plan: "pro",
});

// React-wrapper shape
await tracker.identifyUser({
  userProperties: {
    email: "ada@example.com",
    name: "Ada Lovelace",
  },
});
DetailBehavior
Return valuePromise<string> — the current session’s anonymous endUserId
Mid-session id switchThe anonymous id for the current session is kept; if the server finds an existing user, the canonical id is persisted for future sessions
TransportPOST /api/ingestion/user with Authorization: Bearer <apiKey>
Local cacheTraits merge into tracker + PropertyManager

There is no identifyUser(userId, traits) two-argument form in the current SDK. Pass identifying traits (commonly email) inside the properties object; the server associates / creates the end user.

Incremental traits

tracker.setUserProperty("plan", "enterprise");

getUserAttributes() returns the merged local + PropertyManager traits.

What changes in the product

SurfaceEffect
Visitors / UsersRows gain email / name / traits
Session filters“User” filters become useful
IssuesAffected-user counts become meaningful when identity is present
Replay headersKnown-user labels when traits include name/email

Logout / shared devices

tracker.logout();

logout() (browser only):

  1. Clears the human_behavior_end_user_id cookie / localStorage entry
  2. Clears session storage for the active session key
  3. Resets in-memory user properties
  4. Mints a new anonymous endUserId and new sessionId / windowId
  5. Takes a FullSnapshot so the new window can be replayed

Call this when the user signs out of your app so the next person on a shared browser is not merged into the previous identity.

Persistence notes

Storage keyPurpose
human_behavior_end_user_idCookie + localStorage anonymous / canonical user id (365-day cookie)
human_behavior_sessionSession continuity across reloads within the idle window