View as Markdown

About analytics in Hiro

Every LiveOps decision depends on knowing what players actually do: which levels they complete, which offers they buy, where they drop out of a tutorial. Analytics is how Hiro captures that behavior as a stream of events you can measure and segment on. This guide explores where those events come from and what shape they take so that you can act on your data with confidence.

Two sources of events #

Some player behavior is only visible on the client, like which screen a player opened, an ad they saw, or a button they tapped. The analytics system, which ships with the Unity SDK, captures these events on the client.

Other behavior is authoritative on the server, such as currency granted by a reward, an achievement claimed, or a leaderboard score submitted. Hiro’s systems know when these happen, so they emit their own events through publishers, server-side listeners that receive Hiro events and forward them on. You don’t have to send these events yourself, you just choose which types of events you care about and your publishers handle the rest.

Where your events go #

Hiro is only responsible for producing events; you decide where they go. Those destinations are analytics providers: services like Satori, Firebase, or GameAnalytics that receive and store your events, each added to your game as a Hiro integration. On the client, every provider you register receives each event, and you can also write your own. On the server, you register publishers that forward events to whatever backend you use. Nothing about the analytics system ties you to a particular vendor.

Integrating with Satori #

Satori is Heroic Labs’ LiveOps platform, and Hiro ships with a two-way integration to it out of the box. On the server, the built-in SatoriPersonalizer publisher writes events to Satori; on the client, the SatoriSystem provider does the same. Both a player’s client actions and server-authoritative outcomes end up in one profile.

What sets Satori apart as a destination is that it doesn’t just receive events, it feeds decisions back into the game. Behavior you send becomes the raw material for metrics, reports, and audiences, and SatoriPersonalizer reads that segmentation back as remote configuration. Define an audience like “players who reached level 10 but never finished the tutorial”, and Satori delivers targeted config to them, such as a reminder prompt or a gentler difficulty curve.

Automatic events in Satori
Satori also emits a few events on its own. Sessions produce _sessionStart and _sessionEnd, so you don’t need to track session length yourself. Each change to a player property emits a _propertiesUpdate, which you can’t suppress, so batch property changes rather than writing them one at a time. See Understand events and Sessions.

How an event is shaped #

Every analytics event contains three fields: a name that identifies it, metadata for context about a single occurrence, and a value that’s used to power metrics.

Value, metadata, or property

Each field suits a different kind of data:

  • Use value for a number whose latest reading means something on its own and can feed a metric, like the score from a finished match. Satori turns this field into metrics and computed properties.
  • Use metadata for per-moment context about a single occurrence, like the number of cards left in a player’s hand when they played a card.

See Understand events for a deeper understanding of each field.

Hiro ships with a set of built-in events tied to its systems. The economy system emits currencyGranted and currencySpent, the achievements system emits achievementClaimed, and so on across every system.

Review the full list of built-in server events and client events. You can also send custom events with names of your own choosing.

Add your own metadata to server events #

When you call a Hiro RPC, you can add any metadata you want to the request, and it will be passed along to every server event that call sends. Each server event already carries metadata Hiro sets for it. For example, achievementClaimed carries achievementId, currencyGranted carries currencyId. Your keys are merged into that, so every event will arrive with the metadata Hiro set plus the metadata you set.

Context belongs to a Hiro action #

An action is a single Hiro RPC call, like claiming an achievement or buying from the store. Whatever context you set on that call will be passed along to every event the call sends.

Say you want to add the player’s level to the metadata when they claim an achievement.

1
2
await achievementsSystem.ClaimAchievementsAsync(new[] { "first_win" },
    analyticsContext: new Dictionary<string, string> { { "playerLevel", "42" } });

If the player earns coins from that achievement, Hiro will send a currencyGranted event along with achievementClaimed. You’ll see playerLevel in the metadata of both.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
[
  {
    "name": "achievementClaimed",
    "metadata": { "achievementId": "first_win", "playerLevel": "42" }
  },
  {
    "name": "currencyGranted",
    "value": "100",
    "metadata": {
      "currencyId": "coins",
      "source": "achievementClaimed",
      "sourceId": "first_win",
      "playerLevel": "42"
    }
  }
]

You’ll also see one event name carry different metadata depending on the action behind it. currencyGranted from an achievement claim will carry the context you set on the claim. currencyGranted from an economy grant will carry the context you set on the grant.

Where it applies #

You can set a context on most Hiro system calls, across achievements, economy, inventory, energy, streaks, progression, stats, tutorials, unlockables, auctions, challenges, incentives, event leaderboards, and their team equivalents. The server event reference lists every event these calls can produce.

Namespace your keys #

If one of your keys matches a key Hiro sets on an event, your value will be dropped from that event. We recommend that you avoid using the built-in keys in Hiro. Check the server event reference for the names in use. The short generic ones are the most likely to collide: source, id, name, type, count and amount. trace_id is reserved too.

Custom publishers see it too #

If you write your own publisher, you’ll get this for free. The metadata is merged before your Send is called, so you’ll read your keys straight off event.Metadata.

See also #