identify connects your external ID to a Spotzee contact and updates its traits. Until you call it, BrowserClient sends activity with the anonymous ID held by that client instance.
Identify a known contact
BrowserClient reuses its anonymous ID, so you don’t need to pass anonymousId to each call. The Node Client requires an external ID for identify; its anonymous ID is optional. Pass a previously tracked anonymous ID when you need to join that activity.
How traits flow
The SDK sendstraits as the contact’s data fields. Read Define custom contact attributes to review discovered attribute paths; project admins can set their visibility there.
A few traits map to specific behaviour:
emailandphone: top-level fields the email and SMS channels read from. Pass them throughidentifyarguments rather than nesting them intraitsso the SDK puts them in the right place.timezoneandlocale: drive personalisation and send-time logic. Pass them throughidentifyarguments. The browser SDK does not infer them; if you want browser locale, readnavigator.languageand pass it in.
Anonymous to known: automatic alias
The firstidentify call after an anonymous session aliases the anonymous ID to your external_id. All prior anonymous activity now belongs to the known contact. The browser SDK caches the external_id after this call, so subsequent track and identify calls carry both IDs automatically.
For server contexts where you already know the anonymous ID separately (for example, a user signed up server-side with a session you tracked earlier), call alias directly:
When to call identify
- On sign-up. First call after the user creates an account.
- On sign-in. So a user switching devices or browsers 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 page load 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
BrowserClient caches externalId for the lifetime of its instance. To clear it on sign-out, replace that instance:
BrowserClient 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 contact attributes
Review discovered attributes and their visibility.