Skip to main content
These calls let you tie anonymous sessions to real users and keep their profile data up to date.

Identify the User on Login

What happens? When a visitor logs in, you replace the SDK’s anonymous session ID with their known user ID (often their email). From that point on, every event they generate is attributed to that ID. When to call it? Right after your login flow succeeds. How to call it:
ExpAnalyticsService.login(userEmail);
  • userEmail: a unique string for this user.

Revert to Anonymous on Logout

What happens? When they log out, you discard the user’s ID and switch back to a fresh anonymous identifier, so further events aren’t tied to their account. When to call it? Right after your logout flow completes. How to call it:
ExpAnalyticsService.logout();

Send or Update User Profile

What happens? You upload the user’s metadata—name, email, organization, phone, plus any custom fields to the analytics backend so you can segment on those attributes. When to call it?
  • Immediately after login (to set up the profile).
  • Any time the user updates their account info.
How to call it:
const userDetails = {
  name:         'Jane Doe',
  username:     'jdoe',
  email:        'jane.doe@example.com',
  organization: 'Acme Corp',
  phone:        '+1-555-1234',
  custom: {
    plan:       'premium',
    signupDate: '2025-07-01'
  }
};

// Enqueue the profile-update event
ExpAnalyticsService.updateUserDetails(userDetails);

Putting It All Together

  1. Anonymous browsing: SDK uses a generated session/device ID.
  2. Login:
    • Call login → switches to the user’s ID.
    • Call updateUserDetails → uploads their profile attributes.
  3. Logout:
    • Call logout → switches back to anonymous.
This flow ensures every event is correctly tagged with the right user context, and that you always have their latest profile data for reporting and analysis.