> For the complete documentation index, see [llms.txt](https://docs.hackle.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hackle.io/en/development-guide/android/event-tracking.md).

# Event Tracking

The Hackle SDK provides the ability to send user events to Hackle. By using this feature at every point where user behavior changes, you can obtain meaningful data about user actions, and use that data to analyze user behavior.

{% hint style="info" %}
You can view sent events in the [Event Management](https://dashboard.hackle.io/event-management) menu on the Dashboard.

It generally takes up to \~60 seconds for events to appear in the Dashboard after being sent.
{% endhint %}

## track

Pass the **Event Key** to the `track()` method to send a user event.

<table><thead><tr><th width="150">Parameter</th><th width="120">Type</th><th width="120">Required</th><th>Constraints</th></tr></thead><tbody><tr><td>Event name (key)</td><td><code>string</code></td><td>Required</td><td>Maximum 128 characters.</td></tr></tbody></table>

### Example

Assume you have defined an event key called `purchase` to collect events when a user clicks the purchase button.

{% tabs %}
{% tab title="Kotlin" %}

```kotlin
import io.hackle.android.HackleApp
import io.hackle.sdk.common.Event

hackleApp.track("purchase")
```

{% endtab %}

{% tab title="Java" %}

```java
import io.hackle.android.HackleApp
import io.hackle.sdk.common.Event

hackleApp.track("purchase");
```

{% endtab %}
{% endtabs %}

### Property

The Hackle SDK supports adding properties to Event objects.

* Properties must be sent as key-value pairs (Property Key and Property Value).
* A maximum of 64 properties can be added to an event object.

<table><thead><tr><th width="133.04296875">Category</th><th width="127.60546875">Type</th><th>Constraints</th></tr></thead><tbody><tr><td>Property Key</td><td><code>string</code></td><td><ul><li>Character limit is 128 characters.</li><li>Case-insensitive.</li><li>For example, AGE and age are recognized as the same Property Key.</li></ul></td></tr><tr><td>Property Value</td><td><code>boolean</code>, <code>string</code>, <code>number</code>, <code>array</code></td><td><ul><li>For string type, the character limit is 1024 characters.</li><li>String type is case-sensitive.</li><li>For example, APPLE and apple are recognized as different Property Values.</li><li>For number type, up to 15 integer digits and up to 6 decimal places are supported.</li></ul></td></tr></tbody></table>

#### Example

The example below shows three properties being added: `pay_method`, `discount_amount`, and `is_discount`.

{% tabs %}
{% tab title="Kotlin" %}

```kotlin
import io.hackle.android.HackleApp
import io.hackle.sdk.common.Event

val event = Event.builder("purchase")
    .property("pay_method", "CARD")
    .property("discount_amount", 800)
    .property("is_discount", true)
    .build()


hackleApp.track(event)
```

{% endtab %}

{% tab title="Java" %}

```java
import io.hackle.android.HackleApp
import io.hackle.sdk.common.Event

Event event = Event.builder("purchase")
    .property("pay_method", "CARD")
    .property("discount_amount", 800)
    .property("is_discount", true)
    .build();

hackleApp.track(event);
```

{% endtab %}
{% endtabs %}

## Screen Tracking

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><i class="fa-mobile-screen">:mobile-screen:</i></td><td><strong>Screen Tracking</strong></td><td>Covers the screen information the SDK collects automatically per Activity and how to track screens manually with <code>setCurrentScreen</code>.</td><td><a href="https://docs.hackle.io/en/development-guide/android/event-tracking/android-track-screen.md">Screen Tracking</a></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.hackle.io/en/development-guide/android/event-tracking.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
