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 using their unique FCM token. 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 a user profile, follow the steps below:
- Open the file that contains your login class and pass the user information as parameters in the
ContloAudience()
model. - To start sending the user details to Contlo, use the
sendUserData
method with the following parameters:ContloAudience()
variable that contains the user details.- Boolean value for defining the isUpdate flag. 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.
val contloAudience = ContloAudience(
userFirstName = "First",
userLastName = "Last",
userCity = "City",
userPhone = "+919999999999", // 10 digits phone number
userEmail = "[email protected]",
)
Contlo.sendUserData(contloAudience, false)
Email or phone number is a mandatory field for a user profile.
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 using the HashMap
object and define the customProperties as the map variable in the contloAudience()
method.
val customMap = HashMap<String, String>()
customMap.put("custom_key", "data")
customMap.put("custom_key1", "data_1")
val contloAudience = ContloAudience(
userFirstName = "First",
userLastName = "Last",
userCity = "City",
userPhone = "+919999999999", // 10 digits phone number
userEmail = "[email protected]",
customProperties = customMap
)
Contlo.sendUserData(contloAudience, false)
Track Advertising ID
If you want to track anonymous users across devices, you can enable tracking of Advertising ID. To set the Advertising ID as a profile property in the contact details under the Audience Section in your Contlo dashboard, follow the steps below:
- Add the following permission in your AndroidManifest.xml file:
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
You need to explicitly ask your user for their consent to track Advertising ID as per GDPR Compliance Rules.
- To get user consent, use the
sendAdvertisingId()
method as shown below:
Contlo.sendAdvertisingId(<consent>) // Here consent is a boolean value
This feature is optional and Contlo will still be able to track the anonymous user in the same device.