Nx10 Logo
Docs

1. Initialisation

Start a session, establish player identity, and begin tracking.

To begin tracking, you must initialize the SDK. This step creates a session, generates a secure token, and caches the routing endpoints for all subsequent telemetry. You should do this as early as possible in your game's loading sequence.

Because you configured your API keys in the NX10 Configuration Window during setup, you do not need to pass an API key directly into the configuration. The SDK will automatically inject the correct key based on your build settings.

GameBootstrapper.cs
using NX10;
using System.Collections.Generic;
using UnityEngine;

public class GameBootstrapper : MonoBehaviour
{
    void Start()
    {
        StartSessionExample();
    }

    private void StartSessionExample()
    {
        // 1. Define your flat, app-provided metadata
        var appMetaData = new Dictionary<string, object>
        {
            { "gameName", "SuperFarm" },
            { "totalLevels", 120 },
            { "installChannel", "google-play" },
            { "isPaidUser", false }
        };

        // 2. Identify User
        string email = "example@1234.com //optional
        string phoneNumber = 123456789 //Optional

        //3. Initialise the SDK
        NX10Manager.Instance.StartSession(email, phoneNumber, appMetaData, (success) =>
        {
            if (success)
            {
                //the SDK is initialised, now we can start collecting telemetry
                NX10Manager.Instance.StartTelemetry();
            }
        });
    }
}

Telemetry

It is critical to wait for the StartSession callback to complete successfully before calling NX10Manager.Instance.StartTelemetry().

Explicitly triggering StartTelemetry() at this exact stage is what opens the high-frequency telemetry pipeline. Calling it immediately after successful initialisation guarantees that zero baseline metrics are missed, directly improving the precision of your per-user affective models.

Ready to learn more about implementing telemetry?See 5. Telemetry →

Identity Management (Crucial)

Why Identifiers Matter

NX10 relies entirely on longitudinal data. We learn user's unique emotional patterns over weeks and months to build a highly accurate "Per-User Embedding".

If your identifiers change accidentally between sessions, NX10 treats that player as a brand-new user (Cold Start) every time. This destroys the predictive data moat and severely limits the accuracy of your forecasts.

1. Email & Phone Number (Optional)

While the SDK handles getting the DeviceId, hardware changes. If a user upgrades their iPhone, their DeviceId will change.

Providing an Email or PhoneNumber (if your game utilizes account logins) allows the NX10 backend to fuzzy match the new device to their historical profile. This instantly restores their LFM embedding on the new device, preserving their personalized affective predictions.

Stable Metadata vs. Runtime State

The MetaData object inside the initialization signature is reserved for slow-moving or entirely static data. Examples include:

  • The total number of levels available in the current build.
  • The install channel or ad-campaign ID they acquired the game through.
  • A/B testing cohort assignments (e.g., "uiVariant": "B").

Important rules for MetaData:

  • It must be a flat dictionary of primitives (strings, numbers, booleans, or null).
  • No nested arrays or complex JSON objects are allowed.
  • For rapidly changing state (like "Player just leveled up" or "Opened the shop menu"), do not re-initialize the session. Instead, use the Attributes API detailed in the next step.