Identify customers
Link anonymous purchase history to accounts in your authentication system.
Voidhash creates and persists an anonymous distinct ID on first launch. Purchases and events work
before sign-in. If your app has accounts, call identify() after authentication so access follows
the customer across devices.
Identify after sign-in
Pass a stable identifier from your backend, plus optional profile fields:
voidhash.identify(externalUserId = user.id, email = user.email, name = user.name)Use an opaque, unique ID such as a UUID. Do not use an email address or sequential database ID as the primary identifier.
When an anonymous customer signs in, Voidhash moves their purchase history and entitlements to the identified person. Events captured before the switch remain attributed to the anonymous identity.
Sign out
Reset Voidhash after your own sign-out completes:
voidhash.reset()Clears the local identity and cache; the next call generates a new anonymous id.
Set customer attributes
voidhash.setPersonAttributes(
mapOf(
"email" to "ada@example.com",
"name" to "Ada Lovelace",
"plan_source" to "referral",
)
)Attribute values can be strings, numbers, booleans, or null. email and name map to built-in
person fields; other keys become custom traits.
Read the distinct ID
val distinctId = voidhash.getDistinctId()This is useful in support logs and when correlating a client session with your backend.
Anonymous or identified?
| App model | Recommended setup |
|---|---|
| No accounts | Keep the automatically generated anonymous identity. |
| Optional accounts | Let purchases work anonymously, then identify after sign-in. |
| Account required | Identify immediately after restoring your app session. |