Skip to main content

Anonymous users

You don’t have to provide a user id. On configure(), the SDK auto-generates a UUID and persists it in localStorage (falling back to sessionStorage, then memory), so the same visitor keeps the same id across reloads until they clear browser data or you call reset().

Identify users

When you know who the user is (after login, signup, or session restore), attach your own stable id, optionally with attributes in the same call:
Call identify() as early as you reliably can, and use the same id across sessions and devices. Claims, subscription events, and measurement all join on this id (the SDK’s app account id, also readable via Encore.getAppAccountId()), so a stable id keeps a returning user’s history in one place. localStorage is per-origin and per-browser; only your own id survives a device switch. See identify() for the full contract.

User attributes

Attributes power offer targeting and personalization. They merge with existing attributes, so set them incrementally as you learn more about the user:
The supported keys (all optional strings, plus a free-form custom: Record<string, string>) are listed field-by-field in setUserAttributes().

Reset on logout

reset() clears all locally stored SDK state (identity, attributes, queued signals, and any pending unredeemed claim) and generates a fresh anonymous UUID:
Call it on logout and when switching accounts (then identify() the new user). See reset().

Complete flow

Next steps