Skip to main content

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.
Characteristics:
  • 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.
Characteristics:
  • 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 via identify().
Characteristics:
  • Set by your application
  • Links visitor behavior to a known user
  • Enables cross-device personalization
  • Required for user-based recommendations

The identify() Method

Call identify() when a user logs in:

Identity Merging

When you call identify(), Refine links the current visitor’s browsing history to the user account:

The reset() Method

Call reset() when a user logs out:
What reset() does:
  • Clears the user ID
  • Generates a new visitor ID
  • Generates a new session ID
  • Clears any cached personalization
After reset(), previous browsing behavior is no longer linked to subsequent sessions. Call this on logout to preserve user privacy.

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:
  1. Call refine.reset() on their device
  2. Contact Refine support for server-side deletion

Debugging Identity

Next Steps

User Recommendations

Personalization for logged-in users

Consent Plugin

GDPR-compliant consent management