Appearance
Unity
Install
In Window → Package Manager, click +, choose Add package from git URL… and enter:
text
https://github.com/XKD-Labs/simpledatalogs-unity.gitAdd it
csharp
using System.Collections.Generic;
using UnityEngine;
using XKDLabs.SimpleDataLogs;
public sealed class Analytics : MonoBehaviour
{
// Once, at launch, on the main thread.
private void Awake()
{
SimpleDataLogs.Configure("sdl_pub_…", autocapture: AutocaptureOptions.All);
}
}csharp
// Anywhere:
SimpleDataLogs.Track("level_complete", new Dictionary<string, object> { ["level"] = 3, ["score"] = 1200 });Use a public sdl_pub_ key. Events wait in a crash-safe outbox until a 202, so nothing is lost if the game is killed.
Send everything, or only what you choose
- Everything:
AutocaptureOptions.Allsends launches, sessions, scene views and errors. - Pick:
AutocaptureOptions.Sessions | AutocaptureOptions.SceneViews. - Only your own events: leave
autocaptureout.
Screens that are not scenes, such as a shop panel:
csharp
SimpleDataLogs.TrackScreen("Shop");In the first minute
session_startandapp_launched(withis_first_launch) within 10 seconds (5 in the Editor and development builds), or at once withSimpleDataLogs.Flush().- A
screen_vieweach time a scene loads. - Pausing the game or switching away also sends what is waiting.
Autocapture defaults
| Option | With AutocaptureOptions.All |
|---|---|
AppLaunches | on |
Sessions (30 minutes away ends one) | on |
SceneViews (screen = the scene name) | on |
Errors (logged exceptions and errors, as app_error) | on |
Everything else, including the opt-out and WebGL notes, is in the Unity SDK reference.