Overview
Refine tracks three levels of identity to power personalization and analytics:Identity Hierarchy
Visitor ID
Automatically generated on first SDK use and stored in localStorage.- Generated once per browser/device
- Persists across sessions (survives page refresh, browser close)
- Does not persist across devices or browsers
- Used for visitor-based recommendations
In incognito/private mode, visitor IDs are cleared when the browser closes.
Session ID
Automatically generated for each browsing session.- Generated when SDK initializes
- Expires after 30 minutes of inactivity (configurable)
- New session created after timeout
- Used to group interactions within a visit
Configure Session Timeout
User ID
Your application’s identifier for logged-in users. Set viaidentify().
- Set by your application
- Links visitor behavior to a known user
- Enables cross-device personalization
- Required for user-based recommendations
The identify() Method
Callidentify() when a user logs in:
Identity Merging
When you callidentify(), Refine links the current visitor’s browsing history to the user account:
The reset() Method
Callreset() when a user logs out:
- Clears the user ID
- Generates a new visitor ID
- Generates a new session ID
- Clears any cached personalization
Identity in Events
All events automatically include identity information:Complete Authentication Flow
Server-Side Identity
For server-side rendering or API routes, pass identity explicitly:Privacy Considerations
GDPR Compliance
Data Deletion
When a user requests data deletion:- Call
refine.reset()on their device - Contact Refine support for server-side deletion
Debugging Identity
Next Steps
User Recommendations
Personalization for logged-in users
Consent Plugin
GDPR-compliant consent management