Analytics#
Analytics tells you where new players stop and whether they come back. Send analytics is on in the template, but nothing leaves the game until a service is installed (below) and the player has consented where the law asks for it. Turn it off in Hub > Services > Analytics if your privacy policy and store forms do not mention analytics.
Firebase or Unity Analytics?#
| Unity Analytics | Firebase (Google Analytics) | |
|---|---|---|
| Comes with | Unity Gaming Services | Google's Firebase SDK |
| Setup | a package + one manual step: define every event in the dashboard's Event Manager | a package + one settings file; no event setup |
| Limits | 500 custom events per player a month (heavy players go past it; the extra is not counted) | no per-player monthly limit |
| Raw data | SQL Data Explorer in the dashboard | free daily export to BigQuery |
| Google Ads | no | yes: mark events as conversions |
Both can run together: Firebase is added next to Unity Analytics (or none), and gets the same events. If you run Google Ads, use Firebase.
Turn analytics on#
Do it with AI (skill
setup-services, set up once): ask your agent "Turn on Firebase Analytics." Or follow the Hub steps below.
- Hub > Services > Analytics: check that Send analytics is on (it is in the template; this is
Analytics EnabledinContent/GameConfig.asset). - Install at least one service (below).
- Ship the consent form in the EEA and the UK (next section).
- Update your privacy policy and the store forms (Store forms for analytics).
Consent#
Nothing is sent before consent, and events from before it are dropped, not queued.
- With the Google UMP form installed (Ads and consent), analytics waits for the player's answer; under GDPR it needs the measurement purposes. Settings > Privacy choices changes it.
- Without a consent form, the switch alone counts as consent. Only do this where no consent is required, or with a
consent screen of your own (programmers: implement
IAnalyticsConsent).
If no events arrive from EEA phones, check consent first.
What is sent#
A fixed table of game moments, Content/GameConfig.asset > Analytics Events. Each row: the game event, the name
sent, and up to 8 parameters. A game event with no row is never sent; the battle's steady stream (every hit, every
kill) is never sent. No event carries a player's name, typed text, friend code or e-mail.
The main rows: tutorial_step, tutorial_skipped, wave_reached (every 50th wave), ascendant_challenged /
_defeated / _failed, prestiged, summon, purchase (with the store's price and currency), ad_watched,
placement_claimed, offer_shown / offer_expired, pass_claimed, new_day, plus the retention events below.
Hub > Services > Analytics lists the full table with every parameter and its type.
Delete a row to stop sending it; add a row for a game event you want. Validate Content refuses a row with no name, more than 8 parameters or an event that may never be sent.
Retention events#
The events that answer "where do new players drop off, and do they come back?":
| Event | When |
|---|---|
first_kill, first_upgrade, first_summon | once per save, with the seconds since the session started |
boss_result | the first 20 boss fights: win or escape |
wall_hit | 3 boss escapes in a row: where the wall is |
offline_claim | each offline chest claim: minutes away, gold, doubled or not |
push_optin | the notification question's answer |
calendar_claim, mission_claim, event_milestone | each claim |
session_start, session_end | each session, in the first 7 days (a return within 5 minutes is the same session) |
star_up, evolve, gear_upgrade, castle_build, hero_unlocked | what players spend on, per day |
offer_view, ad_offered, summon_result, next_goal_tap | the offer and ad funnel, summon luck (at most 5 a session) |
tutorial_complete, wave_50, first_purchase | once per save: the three conversions for Google Ads |
Tuning (Game Config, Telemetry fields): how many boss fights, the wall streak, the session gap and days, the summon cap. Details: Adapters and backend.
Unity Analytics (Event Manager step)#
- Hub > Services > Online > Install…: add Analytics (
com.unity.services.analytics), with the project linked (see Online services). - Unity Dashboard > Analytics: turn it on.
- Define every event in the Event Manager. Unity Analytics drops any event or parameter it does not know (it lands
in the dashboard's Invalid tab), and Unity has no file or API to create definitions, so this step is by hand:
- Hub > Services > Analytics lists every event of your table with its parameters and types (ids are
string, every number isfloat) and Copy buttons. - Dashboard > Analytics > Event Manager > Create event: the name, then each parameter with its type.
- Create them in the development environment, then Copy to Environment > production.
Pre-flight reminds you with
services.ugs-analytics-events.
- Hub > Services > Analytics lists every event of your table with its parameters and types (ids are
IdleRpgUgsSettings: Analytics on (the default).
Firebase Analytics#
- Create a Firebase project (console.firebase.google.com) and add an Android app with your package name (and an iOS app with your bundle id).
- Download google-services.json (Android) and GoogleService-Info.plist (iOS) from Project settings > Your
apps, and drag them into the
Assetsfolder. Keep them out of public repositories. - Hub > Services > Firebase > Open the download page: download the Firebase Unity SDK packages for
App and Analytics (the
.tgzfiles) and the External Dependency Manager.tgzGoogle lists with them (Firebase App does not install without it). In Package Manager: + > Add package from tarball… for each, that one first. The Firebase code compiles by itself (IDLE_FIREBASE); only a.unitypackageinstall needs you to addIDLE_FIREBASEto the Scripting Define Symbols. - Install Unity's External Dependency Manager (Package Manager > Unity Registry,
com.unity.external-dependency-manager) and, when Unity asks which dependency manager to use, choose Use Unity's External Dependency Manager: it then stands in for the copy Firebase brought. If LevelPlay put an older copy inAssets/MobileDependencyResolver, delete that folder: two copies do not compile together (compile.duplicate-dll). - Assets > External Dependency Manager > Android Resolver > Force Resolve.
- Turn analytics on (above).
At start the game logs [Analytics] Firebase: ready (google-services.json found), or why it is off. A build without
the settings file still works, without Firebase, and Pre-flight shows firebase.config-missing.
Firebase specifics: session_start, session_end and purchase are sent as game_session_start,
game_session_end and game_purchase (Firebase logs its own session and purchase events). Firebase collects nothing,
not even first_open, before consent.
See events on a phone: Firebase's Analytics does nothing in the editor. On an Android phone run
adb shell setprop debug.firebase.analytics.app <your package name>, play, and watch Firebase > DebugView.
Google Ads conversions: in Firebase / GA4 mark tutorial_complete, wave_50 and first_purchase as **key
events** and import them into Google Ads. first_purchase carries the value and currency.
Check events while you play#
- Console:
Settings/FakeServices.asset> Fake analytics on (and Analytics Enabled): one[Analytics] name {params}line per event. - Developer panel (
IDLE_DEV_TOOLS): Event log lists the newest events, even with analytics off; an event held back by the switch or by consent shows as(held).
Store forms for analytics#
With analytics on, declare it:
- Google Play > Data safety: Approximate location, Device or other IDs, Purchase history, App interactions, Diagnostics; purpose Analytics; shared with Unity (and Google for Firebase) as service providers.
- App Store > App Privacy: Usage Data > Product Interaction, Identifiers > Device ID, Purchases > Purchase History; linked to the user, not used for tracking (unless you run Google Ads with ad personalisation on iOS: then the tracking prompt applies).
- Privacy policy: name Unity Analytics and/or Google Analytics for Firebase, what they collect, how long, how to
object. The template in
Documentation/Legal/has the paragraphs.
Research, not legal advice: check the current forms yourself.