Unity Analytics Integration for Mobile Games
Unity Analytics—built-in event collection for Unity projects, no third-party SDK needed. With Unity Gaming Services (UGS) launch, analytics became part of unified platform: same credentials as UGS Authentication, Cloud Save, and Leaderboards.
Initialization via Unity Gaming Services
With Unity 2022+ analytics comes via com.unity.services.analytics package:
using Unity.Services.Analytics;
using Unity.Services.Core;
async void Start()
{
await UnityServices.InitializeAsync();
AnalyticsService.Instance.StartDataCollection();
}
Before StartDataCollection() call SDK doesn't send any data—important for GDPR compliance. If game operates in EU regions, show consent and call StartDataCollection() only after confirmation.
Standard Events vs Custom
Unity automatically sends system events: gameStarted, sceneLoaded, adImpression. For game logic need custom events:
// Player completed level
var levelCompleteParams = new LevelCompleteParameters
{
LevelIndex = currentLevel,
LevelName = "dungeon_01",
Score = playerScore,
Duration = levelDuration
};
AnalyticsService.Instance.RecordEvent(levelCompleteParams);
// Arbitrary event
AnalyticsService.Instance.CustomData("item_purchased", new Dictionary<string, object>
{
{ "item_id", "sword_legendary" },
{ "currency", "gold" },
{ "amount", 500 },
{ "player_level", playerLevel }
});
LevelCompleteParameters is typed class from SDK. Such events automatically land in standard UGS dashboards with ready visualizations without manual schema setup.
Common Gotchas
Event sent but not in dashboard. UGS dashboard updates with delay up to 24 hours for aggregated data. For debugging—enable Debug.unityLogger.logEnabled = true and check console: SDK logs [Analytics] Event queued and [Analytics] Batch sent.
UnityServices.InitializeAsync() hangs in editor. Happens if Project Settings → Services has no Cloud Project ID linked. Without it SDK doesn't know where to send.
Consent flow broken on Android 13+. Using ConsentTracker.CheckConsentInfoUpdate() on Android 13 consent request might not show if GoogleConsentMode not initialized before UnityServices.InitializeAsync(). Order matters.
Data in Unity Dashboard
After events send they appear in Unity Dashboard → Analytics. Built-in reports include:
- Funnel Analysis — progression funnel based on progression events
-
Monetization — revenue from
adImpressionand IAP - Engagement — DAU, session length, retention (D1/D7/D30)
Custom events via CustomData land in Event Browser—build arbitrary queries. For deep analysis Unity supports BigQuery export via Unity Data Hub.
What's Included
- Connect
com.unity.services.analyticspackage via Package Manager - Link Cloud Project ID and configure UGS in editor
- Implement consent flow for GDPR
- Create custom events for key gameplay points
- Verify event sending via Unity Dashboard
Timeline
Basic integration with custom events: 0.5–1 day. Cost calculated individually.







