Skip to main content
Version: SDK 6.0.x

Track events

With the justtrack SDK, you can monitor and record user behavior through events. These allow you to track how your users are using your app. For each event, you can also specify dimensions which you can later use to filter, sort, and group your events in the dashboard.

In this guide, you'll learn to:

  • Track predefined events
  • Track custom events
  • Check live events in the dashboard

Track predefined events

With our SDK, you can track user behavior using predefined events. These events are defined by justtrack and are given special attention in the platform. For example, some metrics are calculated for you if you send data in certain predefined events.

info

You can find our list of predefined events here.

To track an event you need to pass your event to the publish method of your JustTrackSdk instance:

sdk.publish(event: JtLoginEvent(jtAction: "success", jtMethod: "email"))

Here, JtLoginEvent is a subclass of AppEvent. It represents a JtLoginEvent and accepts two predefined dimensions, called jt_action and jt_method. In this example, you pass the values for those dimensions in the constructor.

You can add more dimensions with .add():

sdk.publish(event: JtLoginEvent(jtAction: "success", jtMethod: "email")
.add(dimension: "dimension_name", value: "value"))

This sends the event to the justtrack platform where you can visualize and analyze your data.

Track custom events

Along with predefined events, you can also track custom events. You define these events yourself, and they're not given any special attention in the platform.

To track a custom event, pass an AppEvent object to the publish method of your JustTrackSdk instance:

sdk.publish(event: AppEvent("my_event"))

When you create an AppEvent object, you can supply it with your own event name, like my_event.

You can add more dimensions to your custom event with .addDimension():

sdk.publishEvent(AppEvent("my_event")
.add(dimension: "dimension_name", value: "value"))

This sends the event to the justtrack platform where you can visualize and analyze your data.

Check live events in the dashboard

After you send your first event, you can check the Live Events section on your SDK integration page in the justtrack dashboard. Events appear there about 15 minutes after you track them using the SDK.