Anonymous users
You don’t have to provide a user id. Onconfigure(), 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: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:custom: Record<string, string>) are listed field-by-field in
setUserAttributes().
Where you cannot install the SDK in your own app, such as when you open the
hosted offer page in a webview, send the
attributes with
POST /users/attributes instead. Do not
assume it behaves like setUserAttributes(). It replaces the stored set on every call rather than
merging into it, so send the complete set each time; it takes a whole-number age and refuses
dateOfBirth; and the identifier fields need an app rated 18+ in its store listing.
Reset on logout
reset() clears all locally stored SDK state
(what gets cleared) and generates a
fresh anonymous UUID:
identify() the new user). See
reset().
Complete flow
Next steps
- Present Offers: show offers and handle the result
- SDK Reference: full API contracts