iOS SDK

iOS SDK - Identity

Identify users and attach hashed identifiers with the Pricist iOS SDK.

Pricist gives every install a stable, per-device anonymousId. When you know who the user is, call setUserId — the backend then resolves identity as userId if present, otherwise anonymousId.

User identity

// Attach a userId to all subsequent events
Pricist.shared.setUserId("user_123")
 
// Merge custom properties into the context sent with events
Pricist.shared.setUserProperties(["plan": "pro"])
 
// Clear identity on logout (reverts to anonymousId)
Pricist.shared.clearUserId()

Until setUserId is called, events carry the stable per-install anonymousId. Each track… call snapshots the identity at capture time, so a queued event keeps the identity it was tracked with even if it flushes after a login or logout.

Hashed identifiers (attribution)

For attribution and ad-network matching, supply pre-hashed identifiers. The SDK never sees the raw value — pass the SHA-256 hex hash of the normalized value yourself:

Pricist.shared.setIDFA("00000000-0000-0000-0000-000000000000") // raw IDFA (see Privacy & Consent for ATT)
Pricist.shared.setHashedEmail(sha256OfNormalizedEmail)         // SHA-256 hex of normalized email
Pricist.shared.setHashedPhone(sha256OfE164Phone)               // SHA-256 hex of E.164 phone
Pricist.shared.setHashedExternalId(sha256OfExternalId)         // SHA-256 hex of a CRM / auth ID
MethodValue
setIDFA(_:)The raw IDFA (or nil to clear). Requires ATT authorization — see Privacy & Consent.
setHashedEmail(_:)SHA-256 hex of the user's normalized email
setHashedPhone(_:)SHA-256 hex of the user's normalized phone (E.164)
setHashedExternalId(_:)SHA-256 hex of an external user identifier (CRM / auth ID)

Each setter accepts nil to clear the value. These identifiers, plus the ATT and consent state, ride along on every event's context, so the server-side attribution layer can consume them from the event stream without an SDK change.