Tracking user activities (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: привязка_приложения_в_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 an item to the basket
  TrackerService.productAdd(Product())
  • Removing an item from the basket
 TrackerService.productRemove(Product())
  • Adding an item to favourites
 TrackerService.productLike(Product())
  • Deleting an item from favourites
 TrackerService.productDislike(Product())
  • Purchase

The items added to the basket using the “productAdd” method are not applied in this case. The “items” 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? //обязательное
    public var phone: String? //необязательное
    public var firstName: String? //необязательное
    public var lastName: String? //необязательное
    public var groups: [Any]? //необязательное, массив с id групп рассылок и/или системными именами групп рассылок, которые должны быть присвоены подписчику при добавлении в платформу
    public var mainChannel: String? //необязательное, указывается в случае, если одновременно передается емейл и телефон (по умолчанию емейл)
    public var integrations: [Int64]? //необязательное
    public var extrafields: [String:Any]? //необязательное, список полей данных
}

Order structure:

public struct Order {
    public var orderId: String? //необязательное, по умолчанию генерируется UUID
    public var items: [Product]? //обязательное
    public var sum: Float64? //необязательное
    public var price: Float64? //обязательное для модуля рекомендаций (если присутствует)
    public var count: Int64? //обязательное для модуля рекомендаций (если присутствует)
    public var fields: [String:Any]? //необязательное, передается любая дополнительная информацию по заказу
}

Product structure:

public struct Product {
    public var id: String //обязательное
    public var count: Int64? //необязательное, по умолчанию 1
    public var fields: [String:Any]? //необязательное, передается любая дополнительная информацию по товару
}

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: привязка_приложения_в_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, //обязательное
    var groupId: String?, //обязательное для модуля рекомендаций (если присутствует)
    var count: Int?, //необязательное, по умолчанию 1
    val fields: Map<String,Any>? //необязательное, передается любая дополнительная информацию по товару
)

The Order data class has the following structure:

data class Order(
    var id: String?, //необязательное, по умолчанию генерируется UUID
    var items: ArrayList<Product>, //обязательное
    var sum: Float?, //необязательное
    var price: Float?, //обязательное для модуля рекомендаций (если присутствует)
    var count: Int?, //обязательное для модуля рекомендаций (если присутствует)
    var fields: Map<String, Any>? //необязательное, передается любая дополнительная информацию по заказу
)
  • Adding an item to the basket
 EnkodPushLibrary.ProductActions().AddToCart(Product())
  • Removing an item from the basket
 EnkodPushLibrary.ProductActions().RemoveFromCart(Product())
  • Adding an item to favourites
 EnkodPushLibrary.ProductActions().AddToFavourite(Product())
  • Deleting an item from favourites
 EnkodPushLibrary.ProductActions().RemoveFromFavourite(Product())
  • Purchase

The items added to the basket using the “AddToCart” method are not applied in this case. The “items” 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?, //обязательное
    val phone: String?, //необязательное
    val firstName: String?, //необязательное
    val lastName: String?, //необязательное
    val groups: Array<Any>?, //необязательное, массив с id групп рассылок и/или системными именами групп рассылок, которые должны быть присвоены подписчику при добавлении в платформу
    val integrations: Array<Int>?, //необязательное
    val extrafields: HashMap<String,Any?>?, //необязательное, список полей данных
    val mainChannel: String? //необязательное, указывается в случае, если одновременно передается емейл и телефон (по умолчанию емейл)
)
  • 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)
Last modified: 2023.12.13 10:32 by Anastasia Aniskova