Skip to main content
Sets structured user attributes used for offer targeting, personalization, and analytics. Attributes are merged with any existing values — they are not replaced.

Signature

setUserAttributes(attributes: UserAttributes): Promise<{ success: boolean }>

Parameters

NameTypeDescription
attributesUserAttributesStructured attributes to set for the current user
setUserAttributes() merges with existing attributes. To clear attributes, call reset().

Usage

await Encore.setUserAttributes({
  email: 'user@example.com',
  subscriptionTier: 'premium',
  monthsSubscribed: '6',
  custom: {
    cancelReason: 'too_expensive',
  },
});