Why Identify Users?
When users interact with your app anonymously, you see disconnected events. When you identify users, those events connect into a journey: Anonymous tracking:Setting User ID
Set the user ID once, and all future events include it:- Right after user logs in
- When app loads (if user already authenticated)
- After successful signup
The identify() Method
identify() is an alias for setUserId() - they do the same thing:
identify(), so we support both for familiarity.
Getting Current User ID
Check which user is currently identified:User ID in Initialization
You can set the user ID when creating the client:Clearing User ID
When users log out, clear the user ID to stop associating events with them:Persistent vs Session-Based
The SDK doesn’t persist user IDs automatically. When the page reloads, you need to set it again:Best Practices
Use Stable IDs
Use IDs that don’t change, like database IDs or UUIDs:Set Early
Identify users as early as possible to capture all their events:Don’t Switch Frequently
Avoid switching between many different user IDs from the same client. This can trigger rate limiting. Learn more in Security.User Properties
After identifying users, you can add properties to their profile. This is covered in detail in User Properties.Anonymous to Identified
You can track users anonymously first, then identify them later:setUserId() are associated with the user.
Server-Side Identification
In backend code, set the user ID for each request:React Integration
When using React hooks, user identification happens automatically through the provider:Next Steps
User Properties
Add attributes to user profiles
Security
Understand user ID security