Identify Users
Link events to known users with sessionvision.identify(). Before identification, events are tracked with an anonymous ID. After calling identify, all future events include both the anonymous ID and the user ID.
Basic Usage
sessionvision.identify('user_123', {
email: '[email protected]',
name: 'Jane Smith',
plan: 'pro',
});The first argument is the user ID (string). The second argument is an optional traits object — use it to attach profile data like email, name, or plan.
Forward-only Linking
Identification is forward-only. When you call identify(), all future events are linked to that user ID. Past anonymous events are not retroactively linked. Call identify as early as possible (e.g. right after login) to maximize coverage.
Reset on Logout
Call reset() when a user logs out. This clears the user ID, generates a new anonymous ID, starts a new session, and clears all registered properties.
// On logout
sessionvision.reset();Get Current Identity
const id = sessionvision.getDistinctId();
// Returns userId if identified, anonymousId otherwiseStorage
Identity data is persisted in localStorage so it survives page reloads:
| Key | Purpose |
|---|---|
sessionvision_anonymous_id | Anonymous visitor ID (UUID v4) |
sessionvision_user_id | Identified user ID |
sessionvision_session | Current session data |
sessionvision_registered | Registered properties |
sessionvision_registered_once | Register-once properties |
sessionvision_config | Cached remote config (1hr TTL) |
Privacy
PII in auto-captured element text is automatically masked using pattern detection. Emails, phone numbers, credit card numbers, and SSNs are replaced with placeholders like [EMAIL], [PHONE XXX-XXX-XXXX], and [CARD XXXX].