C++ Usage
Integrate TrackEdge directly into your Unreal Engine C++ code.
C++ Usage
TrackEdge provides a lightweight C++ API for recording analytics events and controlling Session Replay.
All functionality is exposed through the TrackEdgeSubsystem.
Getting the Subsystem
Include the TrackEdge header.
#include "TrackEdgeSubsystem.h"Then retrieve the subsystem from your Game Instance.
UGameInstance* GameInstance = GetGameInstance();
UTrackEdgeSubsystem* TrackEdge =
GameInstance->GetSubsystem<UTrackEdgeSubsystem>();Track Event
Track any custom gameplay event.
TMap<FString, FString> Properties;
Properties.Add(TEXT("Weapon"), TEXT("Sword"));
Properties.Add(TEXT("Damage"), TEXT("25"));
TrackEdge->TrackEvent(
TEXT("Enemy Defeated"),
Properties,
[](bool bSuccess, const FString& Response)
{
if (bSuccess)
{
UE_LOG(LogTemp, Log, TEXT("%s"), *Response);
}
else
{
UE_LOG(LogTemp, Error, TEXT("%s"), *Response);
}
}
);What TrackEdge sends automatically
When an event is tracked, TrackEdge automatically includes:
- Player ID
- Platform
- CPU
- GPU
- RAM
- VRAM
- FPS
- Screen Resolution
- Engine Version
- Build Configuration
- Timestamp
You only need to provide your custom gameplay event name and properties.
Start Replay Session
Start recording a Session Replay manually.
This works even when Automatic Replay is disabled in Project Settings.
TrackEdge->StartReplaySession(
true,
[](bool bSuccess, const FString& Response)
{
if (bSuccess)
{
UE_LOG(LogTemp, Log, TEXT("Replay Started"));
}
else
{
UE_LOG(LogTemp, Error, TEXT("%s"), *Response);
}
}
);End Replay Session
Stop the current Session Replay and upload it to TrackEdge.
TrackEdge->EndReplaySession(
false,
[](bool bSuccess, const FString& Response)
{
if (bSuccess)
{
UE_LOG(LogTemp, Log, TEXT("Replay Uploaded"));
}
else
{
UE_LOG(LogTemp, Error, TEXT("%s"), *Response);
}
}
);Callback
Every TrackEdge API returns the same callback.
[](bool bSuccess, const FString& Response)
{
if (bSuccess)
{
// Request completed successfully.
}
else
{
// Request failed.
}
}| Parameter | Description |
|---|---|
| bSuccess | Indicates whether the request completed successfully. |
| Response | Server response returned by TrackEdge. |
Automatic Retry
TrackEdge automatically retries failed network requests caused by temporary connection issues.
The retry system is built in and covers:
- SDK Initialization
- Player Identification
- Track Events
- Replay Start
- Replay Chunk Upload
- Replay End
No additional code is required.
Best Practices
- Retrieve the subsystem once and reuse it.
- Use meaningful event names.
- Keep custom properties concise.
- Use Automatic Replay for most games.
- Use manual replay only when you need complete control over what gets recorded.
Blueprint and C++ use the same analytics pipeline. Choose whichever workflow best fits your project.
Next
Continue to FAQ to find answers to common questions and troubleshooting tips.