Realtime Identity in the SDKs
The SDKs link a visitor’s identifiers as they sign in, and tell your page or app which profile the visitor belongs to. This page lists the identity calls on each platform.
Linking identifiers
| Call | What it links |
|---|---|
identify(userId, traits) | The user ID to the device’s anonymous ID, and the traits’ email and phone. Identify calls are sent straight away, so a sign-in reaches the graph within moments. |
alias(newId, previousId) | Two user IDs of the same person, for example after an account migration. |
setUserIdentities({ email, phone, … }) | Further identifiers for the current visitor, sent with every event from then on. Pass hashed: true when you send SHA-256 hashes. |
unsetUserIdentities(keys) | Stops sending the named identifiers. |
reset() | Signs the visitor out on this device: a new anonymous ID, and the identity token forgotten. |
Linking calls follow the visitor’s identify consent. Withdrawing it separates the device from the profile at once.
Reading the profile ID
Give the SDK your Site key, then ask for the visitor’s profile:
zeotap.load(writeKey, { identity: { siteKey: 'psk_...' } });
const profile = await zeotap.getProfileId(); // { profileId, graphId, status } or null
const stop = zeotap.onProfileChange(({ profileId, previousProfileId, reason }) => {
// reason: identify, alias, setUserIdentities, session, refresh, reset or consent
});| Platform | Profile ID | Changes |
|---|---|---|
| Browser | getProfileId() (a promise) | onProfileChange(listener) returns a function that stops listening |
| iOS | analytics.getProfileId { profile in … } | onProfileChange { change in … }, removed with removeProfileChangeListener(_:) |
| Android | analytics.getProfileId { profile -> … } | addProfileChangeListener(listener) |
| React Native | await Zeotap.getProfileId() | Zeotap.onProfileChange(listener) returns a function that stops listening |
getProfileId answers null before the visitor has agreed to be identified, and the SDK remembers the profile ID only while they have. It refreshes after every linking call, so a sign-in shows up as a change with the reason identify.
Vouching for a sign-in
Pass an identity token from your server with the sign-in, so the link is verified:
| Platform | Call |
|---|---|
| Browser | identify(userId, traits, { identityToken }) or setIdentityToken(token) |
| iOS | identify(userId:traits:options: IdentifyOptions(identityToken:)) or setIdentityToken(_:) |
| Android | identify(userId, traits, IdentifyOptions(null, token), null) or setIdentityToken(token) |
| React Native | Zeotap.identify(userId, traits, { identityToken }) or Zeotap.setIdentityToken(token) |
| Google Tag Manager | The Identity token field of the Identify tag, or the Set Identity Token tag |
| Adobe Launch | The Identity token field of the Identify action |
The token is attached to the visitor’s events until it expires, and removed from each event as it arrives, so it is never stored or forwarded.
The SDKs hash emails and phone numbers exactly as your warehouse resolution does, so an identifier hashed on a phone and the same identifier from your CRM are one person.