User Management Methods
Methods for getting user information and managing user sessions.getUserId
Get the current user ID.Returns
string | undefined - The user ID if the user is identified, undefined otherwise.
Example
getAnonymousId
Get the anonymous ID. This is always available, even for identified users.Returns
string - The anonymous ID.
Example
getSessionId
Get the current session ID.Returns
string - The session ID.
Example
reset
Reset user identity and start a new session. This is typically called when a user logs out. After callingreset(), the SDK will:
- Clear the user ID
- Generate a new anonymous ID
- Start a new session
- Clear user traits
Returns
void
