Setting User Attributes

Learn how to set user attributes using Adapty iOS SDK. You can then use attributes to segment profiles

You can set optional attributes such as email, phone number, etc, to the user of your app. You can then use attributes to create user segments or just view them in CRM.

To set user attributes, call .updateProfile() method:

let params = ProfileParameterBuilder()
    .withEmail("[email protected]")
    .withPhoneNumber("+1-###-###-####")
    ...with<Key>(<Value>)
    
Adapty.updateProfile(params: params) { (error) in
    if error == nil {
        // successful update                              
    }
}

The allowed keys <Key> of ProfileParameterBuilder() and the values <Value> are listed below:

emailString up to 30 characters
phoneNumberString up to 15 characters
facebookUserIdString up to 30 characters
facebookAnonymousIdString up to 30 characters
amplitudeUserIdString up to 30 characters
amplitudeDeviceIdString up to 30 characters
mixpanelUserIdString up to 30 characters
appmetricaProfileIdString up to 30 characters
appmetricaDeviceIdString up to 30 characters
firstNameString up to 30 characters
lastNameString up to 30 characters
genderEnum, allowed values are: female, male, other
birthdayDate
appTrackingTransparencyStatusATTrackingManager.AuthorizationStatus, app tracking transparency status you can receive starting from iOS 14. To receive it just call let status = ATTrackingManager.AuthorizationStatus. You should send this specific property to Adapty as soon as it changes. let params = ProfileParameterBuilder() .withAppTrackingTransparencyStatus(status)
customAttributesDictionary

Custom user attributes

You can set your own custom attributes. These are usually related to your app usage. For example, for fitness applications, they might be the number of training per week, for language learning app user's knowledge level, and so on. You can use them in segments to create targeted paywalls and offers, and you can also use them in analytics to figure out which product metrics affect the revenue most.

You can set up to 10 custom attributes for the user, the attribute's key and value should be up to 30 characters. The keys can be only strings of letters, numbers, dashes, points, and underscores. The values can be both strings and numbers. Boolean values will be converted to integers.

Contact us if you need higher limits for custom user attributes.


Did this page help you?