Identify users
Bind anonymous sessions to the user accounts you already know. The SDK links the current session - including what happened before the call - and every later session on that device until reset() to the identified user, and carries the device's earlier campaign touchpoints over to the user - no manual session merging needed.
01Basic identification
One call on login is all you need.
Call identify() on login
Use any stable identifier from your system - user ID, email, or internal account reference.
window.Sumidata = window.Sumidata || {
push(m, a) { (this.q = this.q || []).push([m, a, Date.now()]) }
}
Sumidata.push('identify', ['user_7e2a9c'])Sumidata.purchase() is credited to the user passed to identify(). An externalUserId on the order credits a different buyer and wins. See Conversions & attribution.02Handling logout
When the user logs out, clear the identity so the next session starts anonymous.
// on logout
Sumidata.push('reset', [])identify() is called with a different user ID than the one already identified on the device, Sumidata automatically closes the current session and starts a new one - sessions and replays stay separate between accounts. Campaign touchpoints are not split by account: each user identified on the device gets a copy of all the device's touchpoints.03Privacy notes
identify() sends only the ID you pass.
Form-field values - email, phone and name inputs included - are masked in the replay's page recording by default. Network capture is also on by default: it records fetch/XHR request and response bodies with password-, token- and secret-like keys masked, but not email or name fields - so an email your login form sends via fetch/XHR shows in the replay's Network tab. Set captureNetworkBodies: false (or data-capture-network-bodies="false") to stop recording bodies.
identify() takes only the user ID - no traits. That ID is stored as you pass it (surrounding whitespace trimmed) and linked to the session - filter by it on the dashboard's Replays page under External User ID. Pass an internal ID instead of an email if you don't want the email stored.
