Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

User

Authenticated users with consistent experience across devices.

User contexts use these attributes:

AttributeTypeSourceExamplePrivateNotes
keyStringUser Database7D97F0D3-B18C-4305-B110-0317BDB745DCFALSEUser identifier from database (UUID)
anonymousBooleanStatic: falsefalseFALSEAlways false for authenticated users
nameStringUser ProfileJane DoeFALSEUser’s first and last name
emailStringUser Profilejane@example.comTRUEUser’s email address
createdAtNumberUser Database1640995200000FALSEUnix timestamp in milliseconds

Implementation example

Implement a user context like this:

const userContext = {
  kind: "user",
  key: currentUser.id,
  anonymous: false,
  name: `${currentUser.firstName} ${currentUser.lastName}`,
  email: currentUser.email,
  createdAt: currentUser.createdAt,
  _meta: {
    privateAttributes: ["email"]
  }
};

Use cases

Progressive release for features consistent across devices

Use this when you roll out features that work the same way on web, mobile, and tablet. For example, a new user profile layout or account settings feature.

User-level entitlements and overrides

Use this when you enable features for specific users or user groups. For example, beta features for internal employees or premium features for paying customers.

Experimentation for post-authentication activities

Use this when you run experiments on authenticated features like account management, saved preferences, or personalized recommendations. This ensures consistent experience across sessions and devices.

Enable legacy behavior based on user creation date

Use this when you maintain backward compatibility for existing users. For example, grandfather users created before a certain date into the old pricing model or feature set.