URPG LogoTrackEdge Analytics SDK!
Cpp

C++ Usage

TrackEdge can also be used directly in C++.All functions are non-blocking and use Unreal’s HTTP system internally.You can optionally handle success and error callbacks.


Include Header

#include "TrackEdgeManager.h"

Create Manager

## Create Manager

#include "TrackEdgeManager.h"

UTrackEdgeManager* Manager =
    UTrackEdgeManager::CreateTrackManager(TEXT(""), TEXT(""));

Passing empty strings makes TrackEdge automatically use values defined in Project Settings → Plugins → TrackEdge

You can also override them manually if needed:

UTrackEdgeManager* Manager =
    UTrackEdgeManager::CreateTrackManager(
        TEXT("https://your-server.com/capture/"),
        TEXT("your_api_key")
    );

Track Event With Properties

## Track Event With Properties

TMap<FString, FString> Props;
Props.Add(TEXT("level"), TEXT("Level_01"));
Props.Add(TEXT("mode"), TEXT("Hard"));

Manager->TrackEventWithPropertiesInternal(
    TEXT("level_started"),
    Props,
    []()
    {
        UE_LOG(LogTemp, Log, TEXT("Event sent successfully"));
    },
    [](const FString& Error)
    {
        UE_LOG(LogTemp, Error, TEXT("TrackEdge Error: %s"), *Error);
    }
);

Notes

  • All requests are asynchronous.
  • Success callback runs when HTTP returns 200.
  • Error callback returns the server response or HTTP failure.

Track Purchase

Manager->TrackPurchaseInternal(
    TEXT("Premium Upgrade"),
    9.99,
    TEXT("USD"),
    [](){},
    [](const FString& Error){}
);

TrackEdge automatically sends:

  • item_name
  • price
  • currency
  • distinct_id

as event properties.


Custom Session Tracking

• Start Custom Session

Manager->StartCustomSessionInternal(
    TEXT("combat_session"),
    TEXT("Boss fight started"),
    []()
    {
        UE_LOG(LogTemp, Log, TEXT("Session started"));
    },
    [](const FString& Error)
    {
        UE_LOG(LogTemp, Error, TEXT("Start Session Error: %s"), *Error);
    }
);

What This Does

  • Marks the beginning of a named gameplay session
  • Stores session start time internally (In upcoming it will be be more help full to track the crash outs)
  • Sends a custom_session_start event

• End Custom Session

Manager->EndCustomSessionInternal(
    TEXT("combat_session"),
    []()
    {
        UE_LOG(LogTemp, Log, TEXT("Session ended"));
    },
    [](const FString& Error)
    {
        UE_LOG(LogTemp, Error, TEXT("End Session Error: %s"), *Error);
    }
);

What This Does

  • Calculates session duration automatically
  • Sends custom_session_end
  • Includes duration_seconds property

Important

  • You must end a session using the same name used to start it.
  • Duration is calculated internally using FPlatformTime

Person Properties

Set Person Properties

TMap<FString, FString> PersonProps;
PersonProps.Add(TEXT("player_level"), TEXT("12"));
PersonProps.Add(TEXT("subscription"), TEXT("premium"));

Manager->SetPersonPropertiesInternal(
    PersonProps,
    []()
    {
        UE_LOG(LogTemp, Log, TEXT("Person properties updated"));
    },
    [](const FString& Error)
    {
        UE_LOG(LogTemp, Error, TEXT("Person Error: %s"), *Error);
    }
);

What This Does

  • Updates player level metadata
  • Sends a $set event
  • Associates properties with the persistent distinct_id

Auto Person Properties

TMap<FString, FString> AutoProps = Manager->BuildDefaultPersonProperties();

Manager->SetPersonPropertiesInternal(
    AutoProps,
    [](){},
    [](const FString& Error){}
);

Automatically Includes

  • OS
  • Platform
  • Language
  • Engine version
  • Project name
  • Build version

Persistent Distinct ID

TrackEdge automatically:

  • Generates a unique player ID
  • Saves it using SaveGame
  • Reuses it across sessions

No manual user identification setup is required.


Platform Support

TrackEdge works on any platform supported by Unreal Engine’s HTTP module, including:

  • Windows
  • Mac
  • Linux
  • Android
  • iOS
  • Dedicated Server builds
## Thread Safety

TrackEdge uses Unreal’s HTTP module and executes callbacks on the game thread.
It is safe to call tracking functions from gameplay code.