Track events
This page covers every SDK platform and version. A part that applies only to some platforms starts with Platform: …, and a part that applies only to some SDK versions starts with SDK version: ….
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
- Track events with values
- 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.
You can find our list of predefined events here.
To track an event you need to pass your event to the publishEvent method of your JustTrackSdk
instance:
Each predefined event has its own function on the justtrack subsystem. To track a login, call
TrackLoginEvent:
- Android
- iOS
- Unity
- React Native
- Flutter
- Godot
- Unreal
Platform: Android
sdk.publishEvent(JtLoginEvent("success", "email"))
Platform: iOS
sdk.publish(event: JtLoginEvent(jtAction: "success", jtMethod: "email"))
Platform: Unity
JustTrackSDK.PublishEvent(new JustTrack.JtLoginEvent("success", "email"));
Platform: React Native
await JustTrackSdk.publishEvent(new JtLoginEvent('success', 'email'));
Platform: Flutter
await JusttrackSdk.track(JtLoginEvent(
jtAction: 'success',
jtMethod: 'email',
));
Platform: Godot
JustTrackSdk.track(JustTrackSdk.JtLogin.new("success", "email"))
Platform: Unreal
TMap<FString, FString> Dimensions;
FJustTrackVoidResult OnComplete;
OnComplete.BindUFunction(this, GET_FUNCTION_NAME_CHECKED(AMyActor, HandleEventTracked));
JustTrack->TrackLoginEvent(TEXT("success"), TEXT("email"), Dimensions, OnComplete);
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.
This tracks a JtLoginEvent. The first two arguments fill the predefined jt_action and jt_method dimensions.
The following functions are available, one per predefined event:
| Function | Event |
|---|---|
TrackAdEvent | JtAd |
TrackLoginEvent | JtLogin |
TrackProgressionEvent | JtProgression |
TrackPurchaseEvent | JtPurchase |
TrackResourceEvent | JtResource |
Every function takes its predefined dimensions as leading arguments, then a Dimensions map for your own dimensions, then the completion delegate. The optional arguments sit under Advanced in the Blueprint node, so a Blueprint graph only shows what you actually need.
For example, to track a completed level with a duration:
TMap<FString, FString> Dimensions;
Dimensions.Add(TEXT("difficulty"), TEXT("hard"));
JustTrack->TrackProgressionEvent(
TEXT("complete"), // jt_action
true, 42.0, EJustTrackTimeUnit::Seconds, // optional duration
TEXT("chapter_1"), // jt_progression_1
TEXT("level_7"), // jt_progression_2
FString(), // jt_progression_3
Dimensions,
OnComplete);
Pass false for the bHasDuration or bHasCount argument when you don't want to attach a number, and an empty string for any dimension you want to leave out.
You can add more dimensions to an event by calling .addDimension():
.add():
Platform: Godot You can add more dimensions to an event by calling .add_dimension():
You can add more dimensions through the Dimensions map:
- Android
- iOS
- Unity
- React Native
- Flutter
- Godot
- Unreal
Platform: Android
sdk.publishEvent(JtLoginEvent("success", "email")
.addDimension("dimension_name", "value"))
Platform: iOS
sdk.publish(event: JtLoginEvent(jtAction: "success", jtMethod: "email")
.add(dimension: "dimension_name", value: "value"))
Platform: Unity
JustTrackSDK.PublishEvent(new JustTrack.JtLoginEvent("success", "email")
.AddDimension("dimension_name", "value"));
Platform: React Native
await JustTrackSdk.publishEvent(new JtLoginEvent('success', 'email')
.addDimension('dimension_name', 'value'));
Platform: Godot
JustTrackSdk.track(
JustTrackSdk.JtLogin.new("success", "email")
.add_dimension("dimension_name", "value")
)
Platform: Unreal
TMap<FString, FString> Dimensions;
Dimensions.Add(TEXT("dimension_name"), TEXT("value"));
JustTrack->TrackLoginEvent(TEXT("success"), TEXT("email"), Dimensions, OnComplete);
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.
Platform: Android, iOS, Unity, React Native, Flutter, GodotTo track a custom event, pass an AppEvent object to the publishEvent method of your
JustTrackSdk instance:
To track a custom event, pass your own event name to TrackEvent:
- Android
- iOS
- Unity
- React Native
- Flutter
- Godot
- Unreal
Platform: Android
sdk.publishEvent(AppEvent("my_event"))
Platform: iOS
sdk.publish(event: AppEvent("my_event"))
Platform: Unity
JustTrackSDK.PublishEvent(new AppEvent("my_event"));
Platform: React Native
await JustTrackSdk.publishEvent(new AppEvent('my_event'));
Platform: Flutter
await JusttrackSdk.trackEvent('my_event');
Platform: Godot
JustTrackSdk.track_event("my_event")
Platform: Unreal
TMap<FString, FString> Dimensions;
JustTrack->TrackEvent(
TEXT("my_event"), Dimensions, 0.0, EJustTrackEventUnit::None, FString(), OnComplete);
When you create an AppEvent object, you can supply it with your own event name, like my_event.
In Blueprint, only Name and the completion delegate are required. Dimensions, Value, Unit, and Currency sit under Advanced on the node.
Platform: Android, React Native, UnityYou can add dimensions to your custom event with .addDimension():
.add():
Platform: Flutter You can add dimensions to your custom event by passing a map:
Platform: GodotYou can add dimensions to your custom event by passing a Dictionary:
Platform: UnrealYou can add dimensions to your custom event by filling the Dimensions map:
- Android
- iOS
- Unity
- React Native
- Flutter
- Godot
- Unreal
Platform: Android
sdk.publishEvent(AppEvent("my_event")
.addDimension("dimension_name", "value"))
Platform: iOS
sdk.publish(event: AppEvent("my_event")
.add(dimension: "dimension_name", value: "value"))
Platform: Unity
JustTrackSDK.PublishEvent(new AppEvent("my_event")
.AddDimension("dimension_name", "value"));
Platform: React Native
await JustTrackSdk.publishEvent(new AppEvent('my_event')
.addDimension('dimension_name', 'value'));
Platform: Flutter
await JusttrackSdk.trackEvent('my_event', {
'dimension_name': 'value',
});
Platform: Godot
JustTrackSdk.track_event("my_event", {"dimension_name": "value"})
Platform: Unreal
TMap<FString, FString> Dimensions;
Dimensions.Add(TEXT("dimension_name"), TEXT("value"));
JustTrack->TrackEvent(
TEXT("my_event"), Dimensions, 0.0, EJustTrackEventUnit::None, FString(), OnComplete);
This sends the event to the justtrack platform where you can visualize and analyze your data.
Platform: Android, iOS, Unity, React Native, Unreal SDK version: 8.X.X, 1.X.XSet global dimensions
Some dimensions describe the user or the app rather than a single event, such as the app theme a user picked or the onboarding flow they went through. Instead of adding those to every event, set them once as a global dimension. The SDK stores the value and attaches it to every event you track afterwards.
You get three global dimensions, which arrive in the platform as the jt_global_0, jt_global_1, and jt_global_2 predefined dimensions:
sdk.setGlobalDimension0("dark_theme")
sdk.setGlobalDimension1("onboarding_v2")
sdk.setGlobalDimension2("returning_user")
sdk.set(globalDimension0: "dark_theme")
sdk.set(globalDimension1: "onboarding_v2")
sdk.set(globalDimension2: "returning_user")
JustTrackSDK.SetGlobalDimension0("dark_theme");
JustTrackSDK.SetGlobalDimension1("onboarding_v2");
JustTrackSDK.SetGlobalDimension2("returning_user");
await JustTrackSdk.setGlobalDimension0('dark_theme');
await JustTrackSdk.setGlobalDimension1('onboarding_v2');
await JustTrackSdk.setGlobalDimension2('returning_user');
JustTrack->SetGlobalDimension0(TEXT("dark_theme"));
JustTrack->SetGlobalDimension1(TEXT("onboarding_v2"));
JustTrack->SetGlobalDimension2(TEXT("returning_user"));
In Blueprint, drag from Get justtrack and add Set Global Dimension 0, Set Global Dimension 1, or Set Global Dimension 2. You'll find them under justtrack > Events > Global Dimensions. Each node takes a single Value string and returns nothing, so you can chain all three.
Global dimensions persist across app launches, so you only need to set one again when its value changes.
To clear a global dimension, pass Platform: iOS nil Platform: Android, Unity, React Native null Platform: Unreal an empty string:
sdk.setGlobalDimension0(null)
sdk.set(globalDimension0: nil)
JustTrackSDK.SetGlobalDimension0(null);
await JustTrackSdk.setGlobalDimension0(null);
JustTrack->SetGlobalDimension0(FString());
In Blueprint, leave the Value pin empty.
If you set jt_global_0, jt_global_1, or jt_global_2 directly on an event, that value wins for that event. The global value still applies to every other event.
Track events with values
Events can carry numeric values along with dimensions. This is useful for tracking metrics like counts, durations, or monetary amounts.
Track counts
Use count values to track quantities like level completions, items collected, or actions performed:
- Android
- iOS
- Unity
- React Native
- Flutter
- Godot
- Unreal
Platform: Android
sdk.publishEvent(AppEvent("level_complete")
.setCount(15.0)
.addDimension("difficulty", "hard"))
Platform: iOS
sdk.publish(event: AppEvent("level_complete")
.set(count: 15)
.add(dimension: "difficulty", value: "hard"))
Platform: Unity
JustTrackSDK.PublishEvent(new AppEvent("level_complete")
.SetCount(15)
.AddDimension("difficulty", "hard"));
Platform: React Native
await JustTrackSdk.publishEvent(new AppEvent('level_complete')
.setValue(new Value(15, Unit.Count))
.addDimension('difficulty', 'hard'));
Platform: Unreal
TMap<FString, FString> Dimensions;
Dimensions.Add(TEXT("difficulty"), TEXT("hard"));
JustTrack->TrackEvent(
TEXT("level_complete"), Dimensions, 15.0, EJustTrackEventUnit::Count, FString(), OnComplete);
Track time
Use time values to track durations like session length, time spent on a screen, or task completion time:
- Android
- iOS
- Unity
- React Native
- Flutter
- Godot
- Unreal
Platform: Android
// Track time in seconds
sdk.publishEvent(AppEvent("session_ended")
.setSeconds(342.5)
.addDimension("screen", "home"))
// Or in milliseconds
sdk.publishEvent(AppEvent("animation_complete")
.setMilliseconds(1500.0))
Platform: iOS
// Track time in seconds
sdk.publish(event: AppEvent("session_ended")
.set(seconds: 342.5)
.add(dimension: "screen", value: "home"))
// Or in milliseconds
sdk.publish(event: AppEvent("animation_complete")
.set(milliseconds: 1500))
Platform: Unity
// Track time in seconds
JustTrackSDK.PublishEvent(new AppEvent("session_ended")
.SetSeconds(342.5)
.AddDimension("screen", "home"));
// Or in milliseconds
JustTrackSDK.PublishEvent(new AppEvent("animation_complete")
.SetMilliseconds(1500));
Platform: React Native
// Track time in seconds
await JustTrackSdk.publishEvent(new AppEvent('session_ended')
.setValue(new Value(342.5, Unit.Seconds))
.addDimension('screen', 'home'));
// Or in milliseconds
await JustTrackSdk.publishEvent(new AppEvent('animation_complete')
.setValue(new Value(1500, Unit.Milliseconds)));
Platform: Unreal
// Track time in seconds
JustTrack->TrackEvent(
TEXT("session_ended"), Dimensions, 342.5, EJustTrackEventUnit::Seconds, FString(),
OnComplete);
// Or in milliseconds
JustTrack->TrackEvent(
TEXT("animation_complete"), Dimensions, 1500.0, EJustTrackEventUnit::Milliseconds, FString(),
OnComplete);
Track monetary values
Use monetary values to track virtual currency transactions, in-app spending, or other financial metrics:
- Android
- iOS
- Unity
- React Native
- Flutter
- Godot
- Unreal
Platform: Android
sdk.publishEvent(AppEvent("virtual_currency_spent")
.setValue(Money(4.99, "USD"))
.addDimension("item", "premium_pack"))
Platform: iOS
sdk.publish(event: AppEvent("virtual_currency_spent")
.set(money: Money(4.99, "USD"))
.add(dimension: "item", value: "premium_pack"))
Platform: Unity
JustTrackSDK.PublishEvent(new AppEvent("virtual_currency_spent")
.SetValue(new Money(4.99, "USD"))
.AddDimension("item", "premium_pack"));
Platform: React Native
await JustTrackSdk.publishEvent(new AppEvent('virtual_currency_spent')
.setValue(new Money(4.99, 'USD'))
.addDimension('item', 'premium_pack'));
Platform: Unreal
TMap<FString, FString> Dimensions;
Dimensions.Add(TEXT("item"), TEXT("premium_pack"));
JustTrack->TrackEvent(
TEXT("virtual_currency_spent"), Dimensions, 4.99, EJustTrackEventUnit::None, TEXT("USD"),
OnComplete);
A non-empty currency always turns the value into a monetary amount and overrides the unit. Leave the currency empty whenever you track a count or a duration.
In Blueprint, the Track Event node carries the same three inputs, but they're hidden until you expand the Advanced section at the bottom of the node:
- Set Value to the number you want to record.
- Pick a Unit from the dropdown: Count, Seconds, Milliseconds, or None.
- For a monetary amount, leave Unit on None and type a currency code such as
USDinto Currency.
To attach dimensions, add key and value pairs directly on the Dimensions pin, or wire in a String-to-String map variable.
The predefined event nodes work the same way. Track Ad Event and Track Progression Event expose Has Duration, Duration, and Duration Unit under Advanced, while Track Purchase Event and Track Resource Event expose Has Count and Count. Tick the Has Duration or Has Count box to make the number count, and leave it unticked to send the event without one.
Event restrictions
When you create events, you must adhere to the following requirements:
- Event name
- Can't be empty
- Must be shorter than 256 characters
- Is case-sensitive
- Can only consist of printable ISO 8859-1 characters (U+0020 to U+007E as well as U+00A0 to U+00FF)
- Dimension names
- Must be shorter than 256 characters
- May only consist of:
- Lowercase letters in the Latin alphabet (U+0061 to U+007A)
- Underscores (_) (U+005F)
- Numbers (0-9) (U+0030 to U+0039)
- Dimension values
- Must be shorter than 4096 characters
- Can only consist of printable ISO 8859-1 characters (U+0020 to U+007E as well as U+00A0 to U+00FF)
- Other restrictions
- Maximum of 10 dimensions per event
- Event values must be finite (not NaN or Infinity)
- Currency codes must be 3-letter uppercase ISO 4217 strings (e.g., "USD", "EUR")
If your event doesn't match these criteria, it won't be recorded in the justtrack platform.
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.