User Identity
Associate events, sessions, and replays with your users. When a user logs in, call identify() or setUser() to attach their identity to all SDK data.
Quick Start
import WhatzBug from '@whatzbug/react-native';
// After user logs in
WhatzBug.identify('user_123', {
name: 'Jane Doe',
email: 'jane@example.com',
plan: 'pro',
});API Reference
identify(userId, traits?)
Associate the current session with a user ID and optional traits.
| Parameter | Type | Required | Description |
|---|---|---|---|
userId | string | Yes | Unique user identifier |
traits | Record<string, any> | No | Key-value metadata (name, email, plan, etc.) |
setUser(user)
Convenience method that calls identify() with structured fields.
WhatzBug.setUser({
id: 'user_123',
name: 'Jane Doe',
email: 'jane@example.com',
attributes: { plan: 'pro', team: 'engineering' },
});| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Unique user identifier |
name | string | No | Display name |
email | string | No | Email address |
attributes | Record<string, string | number | boolean> | No | Custom key-value metadata |
clearUser()
Remove the current user identity. Call this on logout.
// On logout
WhatzBug.clearUser();When to Call
- Login: Call
identify()orsetUser()after successful authentication. - Logout: Call
clearUser()to disassociate future events from the user. - App launch with stored session: Call
identify()early if the user is already logged in.
Availability — Partial: The SDK-side identity API (
identify(), setUser(), clearUser()) is fully shipped and works with all modules — events, replays, crashes, and Desktop debugging. What is not yet available: cloud-side user dashboards, user search/lookup, and server-side identity enrichment. This means identity data is captured and attached, but there is no cloud UI to browse users or filter sessions by user. This is planned.How It Works
Internally, identify() emits a $identify event with the user ID and traits. clearUser() emits a $clear_user event. These are processed by the event pipeline and persisted to the queue, then flushed to the backend.
When debug mode is enabled, identity events are also streamed to the Desktop App in real time.