Track User Events

Hackle SDK provides the ability to track and send user events to Hackle.
Data on user events is necessary for measuring the results of the experiment based on the metrics initially set for meaningful user behavior analysis.

Track

User events can be tracked and sent by passing the event key to the track() method. In cases where you would also like to know the value, you can put a numeric value in value and send it together as user events.

  • the value can only be in the form of numerical values.

Example

Suppose you have defined an event key called 'purchase' to collect an event when the user presses the purchase button. You may also want to simultaneously collect the exact purchase amount as well. In this case, you can receive the purchase amount together with value.

/* Example 1: Send only the event key */
hackle.Track("purcahse");

/* Example 2: Send the event key and numeric value together */
HackleEvent event = new HackleEvent(eventKey: "purchase", value: 13200);
hackle.Track(event);

Example 1 is showing a case where only the event key is being sent for the purchase action, while example 2 shows a case where both the purchase event key and the purchase amount is being collected via the 'value' component.

Property

Hackle SDK supports adding properties to a User object.

  • Properties must be sent as a pair with both property name (key) and a property value (value).
  • The maximum number of properties that can be added to a User object is 64.

Property Key (Name)

  • The key should be set as a general name, but easily identifiable.
  • The character limit is 64 characters.
  • It is not case sensitive. For example, AGE and age are recognized as the same key.

Property Value

  • The value supports boolean, string, and number types.
  • In the case of string type, the character limit is 64 characters.
  • The string type is case-sensitive. For example, APPLE and apple are recognized as different property values.
  • In the case of number type, up to 15 integers and up to 6 decimal places are supported.

Example

In the example below, you will be able to see that three properties (pay_method, discount_amount, is_discount) have been added.

Dictionary<string, object> properties = new Dictionary<string, object>();
properties["pay_method"] = "CARD";
properties["discount_amount"] = 800;
properties["is_discount"] = true;

HackleEvent event = new HackleEvent(
  eventKey: "purchase", 
  value: 13200, 
  properties: properties
);

hackle.Track(event: event);

Did this page help you?