Documentation Index
Fetch the complete documentation index at: https://docs.spotzee.com/llms.txt
Use this file to discover all available pages before exploring further.
identify joins your external_id (whatever you call users in your own database) to a Spotzee user record and updates that record’s traits. Until you call it, the SDK records activity against a persisted anonymous ID it minted on first use.
Identify a known user
identify is a suspend function. Call it from a coroutine (typically lifecycleScope in a Fragment or Activity, or a long-lived CoroutineScope you manage in your DI container).
id is your external_id. email, phone, and traits are all optional. Pass only what you have.
How traits flow
Anything in thetraits map lands as a top-level field on the user record. The set of accepted traits is defined by your project’s data schema. Read Define custom user attributes for how to add or rename traits.
A few traits map to specific behaviour:
emailandphone: top-level fields the email and SMS channels read from. Pass them as arguments toidentifyrather than nesting them intraitsso the SDK puts them in the right place.timezoneandlocale: drive personalisation and send-time logic. Set them via theIdentityoverload (below) or viatrack(event, properties, user)inline updates.
Map<String, Any>. Values serialise to JSON: strings, numbers, booleans, lists, nested maps.
The Identity overload
For when you need to set the anonymous ID explicitly (for example, restoring a session after a crash) or passtimezone / locale, use the Identity overload:
Anonymous to known: automatic alias
The firstidentify after an anonymous session aliases the anonymous ID to your external_id. All prior anonymous activity now belongs to the known user. Subsequent track and identify calls carry both IDs automatically.
For server-flow contexts where you already know the anonymous ID, call alias directly:
externalId is set on the singleton, identify skips the auto-alias path. Calling alias directly always sends the request.
When to call identify
- On sign-up. First call after the user creates an account.
- On sign-in. So a user switching devices gets joined back to their record.
- When traits change. Updating profile data, plan, lifetime value, billing state. Identify is upsert: pass only the traits that changed.
identify on every Activity resume with the same data. The platform deduplicates server-side, but the network call is wasted.
Worked example: link anonymous browse to checkout
Reset on sign-out
reset clears the cached externalId and the persisted anonymous ID. The next call mints a new anonymous ID. Subsequent activity is anonymous until the next identify.
Next steps
Track events
Trigger journeys and feed segments with custom events.
Define custom user attributes
Decide which traits Spotzee accepts.