Skip to content

Quick Start

This document provides the shortest integration path for the Unity RUM SDK to help you complete verifiable data reporting with minimal steps.

The application supports Agent automatic access and manual access. The following steps describe the minimal configuration for manual access.

Prerequisites

Before you begin, complete the following preparations:

  1. Create a Unity Android app and a Unity iOS app in Real User Monitoring (RUM), and obtain the corresponding App ID
  2. Confirm the reporting endpoint and authentication method:
  3. Local environment deployment: Prepare datakitUrl
  4. Public DataWay: Prepare datawayUrl and clientToken
  5. Confirm that the project has imported ft-sdk-unity.unitypackage
  6. Confirm that the project has installed "com.unity.nuget.newtonsoft-json"

Integration Steps

  1. Drag FTSDK.prefab to the first scene
  2. Call FTUnityBridge.Install(...) at application startup
  3. Initialize RUMConfig and pass in the corresponding App ID for Android and iOS
  4. Initialize LogConfig and TraceConfig as needed
  5. Run the application and trigger a page open, log print, or network request
  6. Verify in the Unity console and the Guance platform that data has been successfully reported

Minimal Initialization Example

FTUnityBridge.Install(new SDKConfig
{
    // Use datakitUrl for local environment deployment
    datakitUrl = "http://10.0.0.1:9529",
    // Use datawayUrl + clientToken for public DataWay
    // datawayUrl = "https://open.dataway.url",
    // clientToken = "client-token",
    env = "prod",
    debug = true,
});

FTUnityBridge.InitRUMConfig(new RUMConfig
{
    androidAppId = "androidAppId",
    iOSAppId = "iOSAppId",
    sampleRate = 1.0f,
});

Choose either datakitUrl or datawayUrl; if using public DataWay, also pass clientToken.

Optional: Initialize Log and Trace

FTUnityBridge.InitLogConfig(new LogConfig
{
    enableCustomLog = true,
    enableLinkRumData = true,
    sampleRate = 1.0f,
});

FTUnityBridge.InitTraceConfig(new TraceConfig
{
    enableNativeAutoTrace = true,
    enableLinkRumData = true,
    sampleRate = 1.0f,
});

Optional: Add Unity Exception Listening

If you want to convert Unity exceptions to RUM Errors, listen to Application.logMessageReceived:

void OnEnable()
{
    Application.logMessageReceived += LogCallBack;
}

void OnDisable()
{
    Application.logMessageReceived -= LogCallBack;
}

void LogCallBack(string condition, string stackTrace, LogType type)
{
    if (type == LogType.Exception)
    {
        FTUnityBridge.AddError(stackTrace, condition);
    }
}

Verify the Integration

  1. Keep debug = true enabled and run the application
  2. Open a page or make a network request
  3. Confirm that logs related to SDK initialization and data synchronization appear in the Unity console
  4. Return to the Guance console and confirm that the corresponding RUM data appears in the application

If you need further troubleshooting, see Troubleshooting.

Next Steps

Feedback

Is this page helpful?