Event Tracking
The Hackle SDK provides a feature to send user events to Hackle. By using this feature at every point where a change in user behavior occurs, you can obtain meaningful data about user behavior and perform user behavior analysis with the collected data.
track
Pass the Event Key and User Identifier to the track() method to send a user event.
Event Name (key)
It is recommended to name it like a typical variable name but in a way that is easy to identify.
Maximum 128 characters.
Example
Assume you have defined an Event Key called purchase to collect an event when a user taps the purchase button.
import io.hackle.sdk.HackleClient
import io.hackle.sdk.common.Event
// Send the "purchase" event triggered by the user identified as "ae2182e0"
/* Example 1: Send event key only */
hackleClient.track("purchase", "ae2182e0")
/* Example 2: Send event key with a numeric value */
val event: Event = Hackle.event("purchase") {
value(13200) // Place the numeric value to collect alongside the event key in value
}
hackleClient.track(event, "ae2182e0")import io.hackle.sdk.HackleClient
import io.hackle.sdk.common.Event
// Send the "purchase" event triggered by the user identified as "ae2182e0"
/* Example: Send event key only */
hackleClient.track("purchase", "ae2182e0");Property
The Hackle SDK supports adding properties to an Event object.
A property must be sent as a key-value pair consisting of a Property Key and a Property Value.
You can add a maximum of 64 properties per event object.
Property Key
string
Character limit is 128 characters.
Case-insensitive.
For example, AGE and age are recognized as the same Property Key.
Property Value
boolean, string, number, array
For string type, the character limit is 1024 characters.
String type is case-sensitive.
For example, APPLE and apple are recognized as different Property Values.
For number type, up to 15 integer digits and up to 6 decimal places are supported.
Example
In the example below, three properties (pay_method, discount_amount, is_discount) have been added.
Last updated