setUserAttributes()
Sets user attributes for use in paywalls and on the Superwall dashboard.
Deprecated SDK
We strongly recommend migrating to the new Superwall Expo SDK, see our migration guide for details.
Purpose
Sets user attributes for use in paywalls and on the Superwall dashboard. If an attribute already exists, its value will be overwritten while other attributes remain unchanged. This is useful for analytics and campaign audience filters you may define in the Superwall Dashboard.
Note: These attributes should not be used as a source of truth for sensitive information.
Signature
async setUserAttributes(userAttributes: UserAttributes): Promise<void>Parameters
Prop
Type
Returns / State
Returns a Promise that resolves once the user attributes have been updated.
Usage
await Superwall.shared.setUserAttributes({
name: user.name,
email: user.email,
username: user.username,
profilePic: user.profilePicUrl,
plan: "premium",
signUpDate: new Date()
})Best Practices
- Set user attributes after calling
identify() - Update attributes whenever relevant user information changes
- Use attributes in campaign audience filters on the Superwall Dashboard
- Don't store sensitive information (passwords, tokens, etc.) as user attributes
Related
getUserAttributes()- Get user attributesidentify()- Identify a user
How is this guide?
Edit on GitHub