User profiling for Android apps
Apptics allows you to associate the tracking data with a user id of an individual using your app. Setting a user id is not mandatory for Apptics to work normally.
Setting the user ID
All the data tracked after calling the below method will be associated with the given user id, with respect to the current Apptics tracking state.
If the tracking state is USAGE_AND_CRASH_TRACKING_WITHOUT_PII, the user id will not be associated with the tracked data even on calling the below method. Read more about tracking states here.
Apptics also provides in-built consent pop-ups which allow app users to control the tracking states.
CopiedAppticsUser.setUser(userId: String)
Setting the user group
Use the below method to set the user with the group or org id. All the data tracked by the Apptics SDK after calling the below method will be associated with the given user id with respect to the current Apptics tracking state.
CopiedAppticsUser.setUserWithOrgId(userId, orgId)
User properties
User properties enable you to attach custom metadata attributes to individual users, such as subscription status, preferences, or demographics. These properties help segment users for targeted analysis and personalized experiences, providing valuable context for understanding how different user cohorts interact with your app.
Property categories
- Custom properties - These are the properties that are app specific and defined by you.
- Predefined properties - These are the properties provided by Apptics to capture basic user details.
List of predefined propeties
FIRST_NAME |
LAST_NAME |
COMPANY_NAME |
CONTACT_NUMBER |
COUNTRY |
REGION |
CITY |
GEO_LOCATION |
GENDER |
LANGUAGE |
DATE OF BIRTH |
Data types
User properties support the below mentioned data types:
- String - Text values (e.g, "premium", "mobile")
- Number - Numeric values (e.g, 25, 10, 15)
- Boolean - True/false values (e.g, true, false)
Use the below snippet to add properties to a user.
Copiedval props = AppticsUser
.AppticsUserPropertyBuilder()
// Adding predefined properties
.setFirstName("Lakshmikanth")
.setLastName("Dhanaraj")
// Adding custom user properties
.addStringProperty("signup_source", "android")
.addBooleanProperty("is_subscribed", false)
.addNumberProperty("signup_time", System.currentTimeMillis())
.build()
AppticsUser.setUser("xyz", userProperty = props)
Limits
- Custom properties: Upto 30 unique custom properties per project.
- Predefined properties: 15 standard properties provided by default per project.
- Key length: Maximum 50 characters per property key.
- Value length: Maximum 250 characters per property value.
Remove the user ID
On calling the below method, the user ID will not be associated with the tracking data. Already associated data will not be affected by this.
CopiedAppticsUser.removeUser(userId: String)
Fetch the current user ID
Use the below snippet to fetch the current user ID.
CopiedAppticsUser.getCurrentUser()