Skip to main content
Links your user ID to the SDK’s anonymous ID for cross-device entitlement tracking and attribution. Call this after a successful login to sync the user’s entitlements across devices.

Signature

public func identify(
  userId: String,
  attributes: EncoreAttributes? = nil
)

Parameters

NameTypeDescription
userIdStringYour user’s unique identifier from your auth system.
attributesEncoreAttributes?Optional structured attributes to set for the user in one call. Defaults to nil.

Usage

Basic identification

// After successful login
Encore.shared.identify(userId: user.id)

With attributes

Encore.shared.identify(
  userId: user.id,
  attributes: EncoreAttributes(
    email: user.email,
    subscriptionTier: user.plan,
    monthsSubscribed: String(user.monthsActive)
  )
)
Call identify() after a successful login. On logout, call reset() to clear the user ID and cached entitlements.