Documentation
LoginGet Started

Installation

Install the game-events.io plugin directly into your Unity project using the Unity Package Manager (UPM).

Unity Package Manager URL
https://github.com/game-events-io/unity-analytics-plugin.git
  1. Open Unity and go to Window > Package Manager.
  2. Click the + button in the top left corner.
  3. Select Add package from git URL...
  4. Paste the URL above and click Add.

Initialization

Initialize game-events.io at the start of your game, typically in your first scene's Awake method.

GameManager.cs
using UnityEngine;
using GameEventsIO;

public class GameManager : MonoBehaviour
{
    void Awake()
    {
        // Initialize with your Project API Key
        // Pass 'true' as the second argument to enable debug logging
        GameEventsIOSDK.Initialize("YOUR_API_KEY_HERE", true);
    }
}

Usage

Track custom events with properties to understand player behavior.

Simple Event
GameEventsIOSDK.LogEvent("level_started");
Event with Properties
var props = new Dictionary<string, object>
{
    { "level_id", 5 },
    { "difficulty", "hard" },
    { "gold_balance", 1500 }
};

GameEventsIOSDK.LogEvent("level_completed", props);
User Properties
// It's that simple. No complex setup required.
GameEventsIOSDK.SetUserProperty("subscription_type", "premium");

// Set multiple user properties
var userProps = new Dictionary<string, object>
{
    { "level", 10 },
    { "guild", "Warriors" }
};
GameEventsIOSDK.SetUserProperties(userProps);
A/B Testing
// Simple A/B Test implementation
if (!PlayerPrefs.HasKey("ab_ad_frequency"))
{
    var testOptions = new [] { "rare", "often" };
    var variant = testOptions[Random.Range(0, testOptions.Length)];
    PlayerPrefs.SetString("ab_ad_frequency", variant);
}

// Track the assigned variant as a user property
var assignedVariant = PlayerPrefs.GetString("ab_ad_frequency");
GameEventsIOSDK.SetUserProperty("ab_ad_frequency", assignedVariant);

MMP & Attribution

To enable attribution on iOS (version 14.5+), you must request user permission for tracking.

Important: Request permission BEFORE initializing the analytics SDK. This ensures that the Advertising ID (IDFA) is captured and sent with your first events (e.g., session_start).

How to do it:
Add the code below to the Start or Awake method of your main script (e.g., GameManager) attached to a GameObject in your game's first scene.

On Android, no extra action is required — the plugin automatically collects the Advertising ID.

iOS ATT Request (Unity)
// iOS 14+ App Tracking Transparency
void Awake()
{
#if UNITY_IOS
    // On iOS, request permission first, then initialize
    GameEventsIOSDK.RequestTrackingAuthorization((status) => 
    {
        Debug.Log($"ATT Status: {status}");
        GameEventsIOSDK.Initialize("YOUR_API_KEY_HERE", true);
    });
#else
    // On other platforms, initialize immediately
    GameEventsIOSDK.Initialize("YOUR_API_KEY_HERE");
#endif
}