User
Authenticated users with consistent experience across devices.
User contexts use these attributes:
| Attribute | Type | Source | Example | Private | Notes |
|---|---|---|---|---|---|
| key | String | User Database | 7D97F0D3-B18C-4305-B110-0317BDB745DC | FALSE | User identifier from database (UUID) |
| anonymous | Boolean | Static: false | false | FALSE | Always false for authenticated users |
| name | String | User Profile | Jane Doe | FALSE | User’s first and last name |
| String | User Profile | jane@example.com | TRUE | User’s email address | |
| createdAt | Number | User Database | 1640995200000 | FALSE | Unix 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.