User activity tracking (tracking) in the mobile application
Features
You can track user behaviour in your mobile application, record their activity, actions with products, orders, etc. Based on the obtained data, segment the base by customer or user activity, which will allow you to conduct marketing campaigns much more effectively.
With connected tracking you have access to such functions as:
- Segmentation by user activity in the app
- Segmentation by customer activity
- Tracking revenue, number of orders and average cheque for each user
Customise tracking for iOS
1. Connecting the library
Set up the mobile app according to the instructions: iOS
Connect the mobile app to enKod as instructed: application_binding_in_enkod
2. Setting up tracking
To use the tracking functionality, you need to call the required method without initialising an instance of the class.
- Adding a product to the basket
TrackerService.productAdd(Product())
- Removing a product from the basket
TrackerService.productRemove(Product())
- Adding a product to favorites
TrackerService.productLike(Product())
- Removing a product from favorites
TrackerService.productDislike(Product())
- Purchase
The products added to the basket using the “productAdd” method are not applied in this case. The “products” field must be filled in for this method.
TrackerService.productBuy(Order())
- Opening the page with the product
TrackerService.productOpen(Product())
- Capture email (login, registration)
TrackerService.subscribe(Subscriber())
- Capture additional information without linking to e-mail
TrackerService.addExtrafields([String:Any])
- Opening an application window
TrackerService.pageOpen(String)
Subscriber structure:
public struct Subscriber { public var email: String? //mandatory public var phone: String? //optional public var firstName: String? //optional public var lastName: String? //optional public var groups: [Any]? //optional, an array with mailing group ids and/or system names of mailing groups, which must be assigned to the subscriber when added to the platform public var mainChannel: String? //optional, indicated if email and phone number are sent simultaneously (default email) public var integrations: [Int64]? //optional public var extrafields: [String:Any]? //optional, list of custom fields }
Order structure:
public struct Order { public var orderId: String? //optional, default UUID generated public var items: [Product]? //mandatory public var sum: Float64? //optional public var price: Float64? //mandatory for the recommendations module (if available) public var count: Int64? //mandatory for the recommendations module (if available) public var fields: [String:Any]? //optional, any additional information on the order is transmitted }
Product structure:
public struct Product { public var id: String //mandatory public var count: Int64? //optional, default 1 public var fields: [String:Any]? //optional, any additional information on the product is transmitted }
Tracking Setup for Android
1. Connecting the library
Set up the mobile app according to the instructions: Android
Connect the mobile app to enKod according to the instructions: application_binding_in_enkod
2. Setting up tracking
To use the tracking functionality, you need to call the required method without initialising an instance of the class.
Actions with goods
Cart and favourites objects are initialised each time the application is launched.
The Product data class has the following structure:
data class Product( var id: String, //mandatory var groupId: String?, //mandatory for the recommendations module (if available) var count: Int?, //optional, default 1 val fields: Map<String,Any>? //optional, any additional information on the product is transmitted )
The Order data class has the following structure:
data class Order( var id: String?, //optional, default UUID generated var items: ArrayList<Product>, //mandatory var sum: Float?, //optional var price: Float?, //mandatory for the recommendations module (if available) var count: Int?, //mandatory for the recommendations module (if available) var fields: Map<String, Any>? //optional, any additional information on the order is transmitted )
- Adding a product to the basket
EnkodPushLibrary.ProductActions().AddToCart(Product())
- Removing a product from the basket
EnkodPushLibrary.ProductActions().RemoveFromCart(Product())
- Adding a product to favorites
EnkodPushLibrary.ProductActions().AddToFavourite(Product())
- Removing a product from favorites
EnkodPushLibrary.ProductActions().RemoveFromFavourite(Product())
- Purchase
The items added to the basket using the “AddToCart” method are not applied in this case. The “products” field must be filled in for this method.
EnkodPushLibrary.ProductActions().ProductBuy(Order())
- Opening the page with the product
EnkodPushLibrary.ProductActions().ProductOpen(Product())
Actions with subscriber
The SubscriberInfo data class has the following structure:
data class SubscriberInfo( val email: String?, //mandatory val phone: String?, //optional val firstName: String?, //optional val lastName: String?, //optional val groups: Array<Any>?, //optional, an array with mailing group ids and/or system names of mailing groups, which must be assigned to the subscriber when added to the platform val integrations: Array<Int>?, //optional val extrafields: HashMap<String,Any?>?, //optional, list of custom fields val mainChannel: String? //optional, indicated if email and phone number are sent simultaneously (default email) )
- Capture email (login, registration)
EnkodPushLibrary.Subscriber().Subscribe(SubscriberInfo())
- Capture additional information without linking to e-mail
EnkodPushLibrary.Subscriber().AddExtraFields(Map<String, Any>)
- Opening an application window
EnkodPushLibrary.Subscriber().PageOpen(String)