Setting User Attributes
By setting user attributes, you can display information about the user on the paywall. You can also define rules in a campaign to determine which paywall to show to a user, based on their user attributes.
You do this by passing a [String: Any]
dictionary of attributes to Paywall.setUserAttributes(_:)
:
extension PaywallService {
static func setUser() {
guard let user = Auth.shared.user else {
return
}
var attributes: [String: Any] = [
"name": user.name,
"apnsToken": user.apnsTokenString,
"email": user.email,
"username": user.username,
"profilePic": user.profilePicUrl
]
Paywall.setUserAttributes(attributes)
}
}
Then, when you configure your paywall, you can reference the attributes in its text variables. For more information on how to that, see Configuring a Paywall.
In the future, you'll be able to use user attributes to:
- Email/notify users about discounts.
Updated 26 days ago
Did this page help you?