A User profile contains information about the user like email, phone number, name, etc. Contlo creates a user profile for each user that launches your application, regardless of the login status.
There are two types of users:
- Anonymous Users: Unidentified users whose profile does not have an email or a phone number. When a new user launches your application, Contlo creates an anonymous profile for them. The profile includes a Mobile Push Subscription that is in a pending state.
- Identified users: These are users with known email or phone number information.
Set up profile details
To set up the user profile, use the sendUserData()
method in the Contlo iOS SDK. You only need to call this method once. Add this method to the file that contains the application's login flow.
This method takes the following as parameters:
- audience: A variable that contains the user details.
- isUpdate: A boolean value that specifies whether to update an existing profile. True updates primary parameters (Email, phone) of an existing user. If set to False, the profile update depends on the entered values: if it matches an existing user, their information is updated; otherwise, a new user is created for unique values.
Refer to the code below:
let firstName = "Dummy"
let lastName = "User"
let email = "[email protected]"
let phone = "+918899889989"
let userData = ["userId": "test-user"]
let finalAudience = Audience(firstName: firstName, lastName: lastName, userEmail: email, userPhone: phone, customProperties: userData)
Contlo.sendUserData(audience: finalAudience,isUpdate: false) {result in
print("Sending user data: \(result)")
}
Profile Properties
These are the custom properties of a user that accept key-value pairs. Profile properties contain some extra information about the user. You can define these properties under custom_propeties
in the sendUserData()
method as shown below:
let firstName = "Dummy"
let lastName = "User"
let email = "[email protected]"
let phone = "+918899889989"
let userData = ["userId": "test-user"]
let finalAudience = Audience(firstName: firstName, lastName: lastName, userEmail: email, userPhone: phone, customProperties: userData)
Contlo.sendUserData(audience: finalAudience) {result in
print("Sending user data: \(result)")
}
After you define the user details, you can see all the user's information in the Audience section on the Contlo Dashboard.