Event Tracking

The Hackle SDK provides the ability 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 analyze user behavior through the collected data.

track

You can send user events by passing an Event Key and User Identifier to the track() method.

Event Name (key)

  • It is recommended to name it like a typical variable name but make it easy to identify.

  • Character limit is 128 characters. (128 characters)

Example

Assume you have defined an Event Key called purchase to collect events when a user clicks the purchase button.

<?php

require 'vendor/autoload.php';

$client = \Hackle\HackleClients::create("YOUR_SDK_KEY");

// "ae2182e0"라는 식별자를 가진 사용자가 발생시킨 "purchase"라는 이벤트를
// 숫자 값과 함께 전송
$user = \Hackle\Common\HackleUser::builder()
    ->deviceId("ae2182e0")
    ->build();
$event = \Hackle\Common\HackleEvent::builder("purchase")
    ->property("pay_method", "CARD")
    ->property("discount_amount", 800)
    ->property("is_discount", true)
    ->build();

$client->track($event, $user);

?>

Property

The Hackle SDK supports adding properties to Event objects.

  • A property must be sent as a pair of a Property Key (key) and a Property Value (value).

  • The maximum number of properties that can be added to an event object is 64.

Category
Type
Constraints

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.

Last updated