GameAnalytics
Unity Analytics
Mobile Game Development
Telemetry
Game Engineering
LiveOps

GameAnalytics Unity SDK Setup Guide: Events, Funnels & Retention Tracking

13 min read
Eshan Naithani

Shipping a Unity mobile or WebGL game without structured telemetry leaves product and engineering teams guessing why players churn. Total install counts tell you nothing about whether players are stalling on step 3 of your First-Time User Experience (FTUE), running out of soft currency on Level 8, or encountering an unhandled exception on low-RAM Android devices.

The GameAnalytics Unity SDK provides a lightweight, event-batched telemetry pipeline purpose-built for games. Out of the box, it captures session duration, Day 1 (D1), Day 7 (D7), and Day 30 (D30) retention cohorts, and exposes six core event schemas in C#: Progression, Resource, Business, Ad, Design, and Error events.

This engineering guide walks through installing the current GameAnalytics Unity SDK, configuring the Settings asset, implementing a production-grade C# telemetry wrapper, instrumenting onboarding and level funnels, validating receipts, and debugging event payloads before launch.

Building a commercial Unity mobile or browser game? See how we instrumented progression and economy telemetry in our Bird Sort Mania 20-Day Unity Case Study, or explore our Unity Game Development Services.


1. Core Telemetry Schemas & What Each Event Measures

Before writing C# instrumentation, map each product question to the correct GameAnalytics event type. Using NewDesignEvent for everything is one of the most common mistakes in Unity projects—it bypasses built-in progression win-rate matrices, economy Sink/Source graphs, and revenue conversion tables.

Product / LiveOps MetricGameAnalytics SDK MethodRequired ParametersEngineering & Design Use Case
D1 / D7 / D30 RetentionAutomatic session heartbeat after GameAnalytics.Initialize()Valid Game Key, Secret Key, and Build stringMeasure cohort stickiness after FTUE and meta-loop changes
FTUE & Tutorial FunnelGameAnalytics.NewDesignEvent(eventId, value)Colon-delimited hierarchy (FTUE:01_Boot, FTUE:02_FirstSort)Pinpoint exact onboarding step where new installs abandon the session
Level Win Rate & AttemptsGameAnalytics.NewProgressionEvent(status, p01, p02, p03, score)GAProgressionStatus.Start, Complete, or Fail + up to 3 hierarchy stringsDetect difficulty spikes via automatic attempt-to-complete ratios
Virtual Economy BalanceGameAnalytics.NewResourceEvent(flowType, currency, amount, itemType, itemId)GAResourceFlowType.Source (earned) or Sink (spent) + registered currencyAudit soft/hard currency inflation and booster consumption per level
IAP Revenue & ARPDAUGameAnalytics.NewBusinessEvent / NewBusinessEventIOS / NewBusinessEventGooglePlayISO 4217 currency ("USD"), amount in integer cents (499), itemType, itemId, cartTypeTrack verified gross revenue, paying user conversion, and store placement performance
Ad Impressions & eCPM ContextGameAnalytics.NewAdEvent(adAction, adType, adSdkName, adPlacement)GAAdAction (Show, Clicked, RewardReceived, FailedShow) + GAAdTypeCorrelate rewarded video and interstitial frequency with session length
Runtime StabilityGameAnalytics.NewErrorEvent(severity, message)GAErrorSeverity (Debug, Info, Warning, Error, Critical)Surface non-fatal C# exceptions and asset loading failures by build version

2. Installing & Configuring the GameAnalytics Unity SDK

Step 1: Package Installation

You can install the GameAnalytics Unity SDK via the Unity Package Manager (UPM), OpenUPM, or the official .unitypackage release from the GameAnalytics Unity SDK documentation:

  1. Ensure Unity's External Dependency Manager for Unity (EDM4U) is present if targeting Android (build.gradle resolution) and iOS (Podfile CocoaPods resolution).
  2. Import the GameAnalytics SDK package into your project.
  3. Open the configuration inspector via Window > GameAnalytics > Select Settings. This creates Assets/Resources/GameAnalytics/Settings.asset.

Step 2: Platform Keys & Build Versioning

Inside the Setup tab of the GameAnalytics Settings inspector:

  • Add Platforms: Select your target platforms (Android, iOS, WebGL, Windows, etc.) and paste the Game Key and Secret Key generated in your GameAnalytics organization dashboard for each platform.
  • Build Version: Either bind the build version dynamically (Use Player Settings Build Version on iOS/Android) or specify a semantic version string (major.minor.patch, such as 1.2.0). Filtering telemetry by build version is essential when verifying whether a patch fixed a level spike or crash.

Step 3: Pre-Registering Resource Currencies, Item Types & Custom Dimensions

GameAnalytics enforces a strict client-side schema whitelist for virtual economy and custom dimension tags. In Window > GameAnalytics > Select Settings > Setup, configure these lists before calling them in code:

  • Resource Currencies (up to 20 allowed, ASCII letters only): e.g., Coins, Gems, Energy.
  • Resource Item Types (up to 20 allowed): e.g., Booster, Skin, LevelReward, IAPPack, Revive.
  • Custom Dimensions 01 / 02 / 03 (up to 20 predefined strings per dimension): Useful for cohort segmentation such as Control_Group vs Variant_FastTutorial or device RAM tiers (LowRAM, MidRAM, HighRAM).

3. SDK Initialization & Privacy / ATT Order of Operations

The GameAnalytics SDK must be initialized once per application launch in a persistent bootstrap scene before any gameplay or menu events fire.

If you need to override build versions, register resource currencies dynamically via code, set a custom user ID, or request iOS App Tracking Transparency (ATT) authorization, those calls must happen before GameAnalytics.Initialize().

CSHARP
using UnityEngine;
using GameAnalyticsSDK;

namespace MyGame.Analytics
{
    public sealed class AnalyticsBootstrapper : MonoBehaviour, IGameAnalyticsATTListener
    {
        public static bool IsInitialized { get; private set; }

        [SerializeField] private bool enableManualResourceConfig = false;

        private void Awake()
        {
            if (IsInitialized)
            {
                Destroy(gameObject);
                return;
            }

            DontDestroyOnLoad(gameObject);
            ConfigurePreInitSettings();
            StartInitializationFlow();
        }

        private void ConfigurePreInitSettings()
        {
            // Always synchronize the telemetry build tag with Unity's Application.version
            GameAnalytics.ConfigureBuild(Application.version);

            if (enableManualResourceConfig)
            {
                GameAnalytics.ConfigureAvailableResourceCurrencies("Coins", "Gems");
                GameAnalytics.ConfigureAvailableResourceItemTypes(
                    "LevelReward",
                    "Booster",
                    "Revive",
                    "Skin",
                    "IAPPack"
                );
            }
        }

        private void StartInitializationFlow()
        {
#if UNITY_IOS && !UNITY_EDITOR
            // On iOS 14.5+, wait for ATT status resolution before initializing
            GameAnalytics.RequestTrackingAuthorization(this);
#else
            CompleteInitialization();
#endif
        }

        private void CompleteInitialization()
        {
            if (IsInitialized) return;

            GameAnalytics.Initialize();
            IsInitialized = true;
            Debug.Log($"[Analytics] GameAnalytics Initialized (Build {Application.version})");
        }

        // IGameAnalyticsATTListener callbacks for iOS
        public void GameAnalyticsATTListenerNotDetermined() => CompleteInitialization();
        public void GameAnalyticsATTListenerRestricted() => CompleteInitialization();
        public void GameAnalyticsATTListenerDenied() => CompleteInitialization();
        public void GameAnalyticsATTListenerAuthorized() => CompleteInitialization();
    }
}

4. Instrumenting Progression Events (NewProgressionEvent)

Progression events measure player movement through sequential content (worlds, chapters, levels, or stages). They support up to three hierarchical location parameters (progression01, progression02, progression03) and three states:

  1. GAProgressionStatus.Start: Fired when a level attempt begins.
  2. GAProgressionStatus.Fail: Fired when the player loses, runs out of moves/time, or abandons an active attempt.
  3. GAProgressionStatus.Complete: Fired when the player wins the level (optionally passing an integer score).

Critical Progression Rules

  • Always pair Start with either Complete or Fail: When a player restarts a level mid-attempt, fire GAProgressionStatus.Fail for the aborted run before firing GAProgressionStatus.Start for the new attempt. Otherwise, GameAnalytics leaves the previous attempt dangling and skews attempt-per-completion calculations.
  • Zero-pad level numbers: Format level identifiers as Level_001, Level_002, ..., Level_010 ($"Level_{levelIndex:D3}") so alphabetical sorting in dashboards matches numerical order.
CSHARP
using UnityEngine;
using GameAnalyticsSDK;

namespace MyGame.Analytics
{
    public static class ProgressionTelemetry
    {
        private static bool _hasActiveAttempt;
        private static string _activeWorldId;
        private static string _activeLevelId;

        public static void LogLevelStart(int worldIndex, int levelIndex)
        {
            if (!AnalyticsBootstrapper.IsInitialized) return;

            // Close any unclosed attempt if the player triggered a quick restart
            if (_hasActiveAttempt)
            {
                GameAnalytics.NewProgressionEvent(
                    GAProgressionStatus.Fail,
                    _activeWorldId,
                    _activeLevelId
                );
            }

            _activeWorldId = $"World_{worldIndex:D2}";
            _activeLevelId = $"Level_{levelIndex:D3}";
            _hasActiveAttempt = true;

            GameAnalytics.NewProgressionEvent(
                GAProgressionStatus.Start,
                _activeWorldId,
                _activeLevelId
            );
        }

        public static void LogLevelComplete(int worldIndex, int levelIndex, int moveEfficiencyScore, float durationSeconds)
        {
            if (!AnalyticsBootstrapper.IsInitialized) return;

            string worldId = $"World_{worldIndex:D2}";
            string levelId = $"Level_{levelIndex:D3}";
            _hasActiveAttempt = false;

            GameAnalytics.NewProgressionEvent(
                GAProgressionStatus.Complete,
                worldId,
                levelId,
                moveEfficiencyScore
            );

            // Pair with a Design event to inspect level duration distributions
            GameAnalytics.NewDesignEvent($"LevelDuration:{worldId}:{levelId}", Mathf.RoundToInt(durationSeconds));
        }

        public static void LogLevelFail(int worldIndex, int levelIndex, string failReason)
        {
            if (!AnalyticsBootstrapper.IsInitialized) return;

            string worldId = $"World_{worldIndex:D2}";
            string levelId = $"Level_{levelIndex:D3}";
            _hasActiveAttempt = false;

            GameAnalytics.NewProgressionEvent(
                GAProgressionStatus.Fail,
                worldId,
                levelId
            );

            // Track the specific failure cause (e.g., OutOfMoves, TimeExpired,Deadlock)
            if (!string.IsNullOrEmpty(failReason))
            {
                GameAnalytics.NewDesignEvent($"LevelFailReason:{worldId}:{levelId}:{failReason}");
            }
        }
    }
}

5. Tracking Virtual Economy (NewResourceEvent) & IAP Revenue (NewBusinessEvent)

Virtual Currency Sources & Sinks

Whenever a player earns currency (GAResourceFlowType.Source) or spends currency (GAResourceFlowType.Sink), record a resource event. Comparing daily Source vs Sink totals per level reveals whether your economy is inflating (players hoarding coins with nothing meaningful to buy) or starving (players hitting hard paywalls too early).

CSHARP
using GameAnalyticsSDK;

namespace MyGame.Analytics
{
    public static class EconomyTelemetry
    {
        public static void LogCurrencyEarned(string currency, float amount, string itemType, string itemId)
        {
            if (!AnalyticsBootstrapper.IsInitialized || amount <= 0f) return;

            GameAnalytics.NewResourceEvent(
                GAResourceFlowType.Source,
                currency,   // Must match Settings.asset (e.g., "Coins")
                amount,
                itemType,   // Must match Settings.asset (e.g., "LevelReward")
                itemId      // Specific identifier (e.g., "LevelClearBonus")
            );
        }

        public static void LogCurrencySpent(string currency, float amount, string itemType, string itemId)
        {
            if (!AnalyticsBootstrapper.IsInitialized || amount <= 0f) return;

            GameAnalytics.NewResourceEvent(
                GAResourceFlowType.Sink,
                currency,   // e.g., "Coins"
                amount,
                itemType,   // e.g., "Booster"
                itemId      // e.g., "ExtraBranch" or "UndoMove"
            );
        }
    }
}

Real-Money In-App Purchases (NewBusinessEvent)

To measure true ARPDAU, ARPPU, and conversion rates without spoofing from modded APKs, wire NewBusinessEvent into your Unity IAP purchase confirmation handler after receipt extraction. For a complete store subsystem walkthrough, see our Unity IAP 5 Setup Guide.

CSHARP
using UnityEngine;
using GameAnalyticsSDK;

namespace MyGame.Analytics
{
    public static class BusinessTelemetry
    {
        /// <summary>
        /// Logs a verified real-money purchase to GameAnalytics.
        /// Note: amountInCents must be an integer (e.g., $4.99 USD = 499).
        /// </summary>
        public static void LogVerifiedPurchase(
            string isoCurrencyCode,
            int amountInCents,
            string itemType,
            string itemId,
            string cartType,
            string rawReceipt = null,
            string googlePlaySignature = null)
        {
            if (!AnalyticsBootstrapper.IsInitialized) return;

#if UNITY_IOS && !UNITY_EDITOR
            GameAnalytics.NewBusinessEventIOS(
                isoCurrencyCode,
                amountInCents,
                itemType,
                itemId,
                cartType,
                rawReceipt
            );
#elif UNITY_ANDROID && !UNITY_EDITOR
            GameAnalytics.NewBusinessEventGooglePlay(
                isoCurrencyCode,
                amountInCents,
                itemType,
                itemId,
                cartType,
                rawReceipt,
                googlePlaySignature
            );
#else
            GameAnalytics.NewBusinessEvent(
                isoCurrencyCode,
                amountInCents,
                itemType,
                itemId,
                cartType
            );
#endif
        }
    }
}

6. Onboarding Funnels, Ad Telemetry & Error Tracking

Designing an FTUE Onboarding Funnel for D1 Retention

Day 1 retention is heavily governed by the first 5 minutes of gameplay. By structuring NewDesignEvent calls with numbered step prefixes, you can build an ordered funnel in the GameAnalytics Funnels tool to measure completion rates between every micro-interaction:

  1. FTUE:01_SceneLoaded
  2. FTUE:02_TutorialPromptShown
  3. FTUE:03_FirstInteractionCompleted
  4. FTUE:04_Level1Completed
  5. FTUE:05_ClaimedFirstReward
  6. FTUE:06_StartedLevel2

For a deep dive into building multi-step onboarding funnels and cohort A/B tests, read our 3-part engineering series:

Ad Impressions (NewAdEvent) & Error Events (NewErrorEvent)

When monetizing with Unity LevelPlay Mediation or Unity Ads, log ad lifecycle actions and runtime errors so you can see whether rewarded ads lift retention or whether ad SDK timeouts cause drop-off:

CSHARP
using GameAnalyticsSDK;

namespace MyGame.Analytics
{
    public static class DiagnosticsAndAdTelemetry
    {
        public static void LogRewardedAdCompleted(string mediationSdk, string placementName)
        {
            if (!AnalyticsBootstrapper.IsInitialized) return;

            GameAnalytics.NewAdEvent(
                GAAdAction.RewardReceived,
                GAAdType.RewardedVideo,
                mediationSdk,   // e.g., "levelplay" or "unityads"
                placementName   // e.g., "ExtraBranch_LevelFail"
            );
        }

        public static void LogRewardedAdFailed(string mediationSdk, string placementName)
        {
            if (!AnalyticsBootstrapper.IsInitialized) return;

            GameAnalytics.NewAdEvent(
                GAAdAction.FailedShow,
                GAAdType.RewardedVideo,
                mediationSdk,
                placementName
            );
        }

        public static void LogHandledError(string context, string errorMessage, bool isCritical = false)
        {
            if (!AnalyticsBootstrapper.IsInitialized) return;

            GAErrorSeverity severity = isCritical ? GAErrorSeverity.Critical : GAErrorSeverity.Error;
            GameAnalytics.NewErrorEvent(severity, $"[{context}] {errorMessage}");
        }
    }
}

7. Testing, Live Feed Validation & Common Implementation Mistakes

Before submitting a build to Google Play, the App Store, or a WebGL portal, validate your event payloads end to end:

  1. Enable Info & Verbose Logging in Editor: In Window > GameAnalytics > Select Settings > Advanced, enable Info Log Editor and Info Log Build (and Verbose Log during staging). In the Unity Console and adb logcat / Xcode console, verify lines reading Info/GameAnalytics: Event queue: Sending X events. with HTTP 200 OK responses.
  2. Inspect the Realtime Live Feed: Open your GameAnalytics dashboard and navigate to Live Feed. Trigger Start, Complete, Fail, Source, Sink, and FTUE events on a test device and confirm each event parses without schema warnings.

Common Implementation Mistakes to Avoid

MistakeWhy It Breaks TelemetryEngineering Fix
Firing events in Awake() before GameAnalytics.Initialize()Multiple Awake() execution order races cause early FTUE events (FTUE:01_Boot) to be silently discardedCentralize initialization in a bootstrapper scene or use Unity's Project Settings > Script Execution Order
Embedding colons inside NewProgressionEvent stringsProgression events already take progression01, progression02, progression03 as separate argumentsPass "World_01", "Level_001" as separate parameters rather than "World_01:Level_001"
Passing dynamic timestamps or GUIDs into NewDesignEvent IDsGenerates thousands of unique event nodes (e.g., LevelTime:14.23s), hitting cardinality limitsPass the metric name as the hierarchy ("LevelDuration:World_01:Level_001") and the numeric duration as the second float value parameter
Passing dollar floats to NewBusinessEventPassing 4.99f truncates or logs 4 cents (\$0.04), underreporting revenue by 99%Multiply price by 100 (Mathf.RoundToInt(price * 100f)) to pass integer cents (499)
Unregistered Resource currencies or ItemTypesNewResourceEvent rejects any currency/itemType not declared in Settings.assetAudit Window > GameAnalytics > Select Settings > Setup before every release build

Frequently Asked Questions


Need help architecting or optimizing your Unity mobile game? Let's discuss your technical roadmap.

Share this article

Get Practical Unity Development Insights

Technical guides on Unity performance, AI gameplay systems, mobile monetization, and game development.

Unsubscribe at any time. Your data is never shared.

Recommended Reading

More articles in Analytics & LiveOps