Signature
Parameters
Your application’s unique identifier for this user. This replaces the anonymous ID.
Optional user attributes for targeting and personalization. See setUserAttributes() for complete list.
Return Value
Type:void
The method doesn’t return a value.
Behavior
When you callidentify():
- Replaces the anonymous ID with your provided user ID
- Optionally sets user attributes in the same call
- Clears cached entitlements when user ID changes
- Updates all internal managers with the new user ID
Examples
Basic Identification
Identify with Attributes
After Login
After Signup
On Page Load (Session Restoration)
Framework Integration
- React
- Vue
- Angular
When to Call identify()
1
After Login
When a user successfully authenticates:
2
After Signup
When a new user creates an account:
3
On App Initialization
If you already have the user’s session:
4
After OAuth/SSO
When a user logs in via OAuth or SSO:
Best Practices
1. Identify Early
Identify users as soon as you have their ID:2. Include Useful Attributes
Set helpful attributes during identification:3. Don’t Call Multiple Times
Only identify when the user changes:4. Handle User Switching
Reset before identifying a different user:Related Methods
- getCurrentUserId() - Get the current user ID
- setUserAttributes() - Update attributes later
- reset() - Clear user identity
Utility Methods
getCurrentUserId()
Get the current user ID (identified or anonymous):- Your custom user ID if
identify()was called - Auto-generated anonymous UUID otherwise
nullif SDK hasn’t initialized yet
Complete Example
Next Steps
After identifying users:- setUserAttributes() - Update attributes over time
- presentOffer() - Show targeted offers
- isActive() - Check entitlements