Implementation of event tracking in the Android SDK
After installing the Renta Android SDK library on your mobile app, you can start collecting data using various tracking methods.
Event tracking methods
Renta provides the following tracking methods:
Event types | Descriptions |
---|---|
Screen | The Screen method tracks the user's screen views in the mobile app. |
Track | The Track method used to record user actions in the application with any properties describing the action. |
Identify | The Identify call associates a user's actions with their unique ID and known properties like email, name, etc. |
Group | The event is used to track a group of users. |
Screen
The Screen method is used to track the moment when a user views a screen in your mobile app, optionally accompanied by additional information (we call them properties) about the page being viewed.
It is recommended that you record a screen event every time the user opens a screen in your app.
To trigger the Screen view event, use the Java code below:
analytics.screen("Car Сatalog", Builders.buildJsonObject(o -> {
o.put("productName", "Tesla Model 3")
.put("productCategory", "Electric Cars")
});
Each track event consists of:
Field name | Mandatory | Field description |
---|---|---|
Event name | ✅ | The name of the screen. For instance, Car catalog. |
Properties | ❌ | This is any additional attributes that you can send along with the event. Used to describe an event. |
Track
The Track method allows you to translate the actions that users perform in your application. Each user action triggers an event, which then records the Track method along with all of its associated properties.
This can be a variety of scenarios, such as registration or in-app purchase.
To trigger the Track view event, use the Java code below:
analytics.track("Car Purchase", Builders.buildJsonObject(o -> {
o.put("carId", "model3-001")
.put("carName", "Tesla Model 3")
});
Each track event consists of:
Field name | Mandatory | Field description |
---|---|---|
Event name | ✅ | The name of the track event. |
Properties | ❌ | This is any additional attributes that you can send along with the event. Used to describe an event. |
Identity
It is necessary to use Identity only at the moment of user identification. Below are the scenarios when one should call this event type:
After successful registration.
After successful authorization.
When the user updated their profile information.
To trigger the Identity event, use the Java code:
analytics.identify("user-001", Builders.buildJsonObject(o -> {
o.put("username", "ElonMusk001")
.put("email", "elon.musk@tesla.com")
.put("favoriteModel", "Tesla Model S")
Each identity event consists of:
Field name | Mandatory | Field description |
---|---|---|
UserId | ✅ | Unique user ID in your application. |
Properties | ❌ | Additional attributes that describe the user. For example, his name or LTV. |
Group
The event is used to unite users into a common group.
The name of the company, department, or project can be used as a group. Thus, you can use any internal identifier in your system.
To call the event, use the Java code:
analytics.group("{groupid_variable}", Builders.buildJsonObject(o -> {
o.put("company", "Tesla")
.put("industry", "Auto Manufacturing"")
.put("employees", 70757);
}));
Each group event consists of:
Fields name | Mandatory | Field description |
---|---|---|
GroupId | ✅ | Unique group/workspace ID in your application. |
Properties | ❌ | Additional attributes that describe the user group. For example, its company name and its industry. |