Search Unity

Getting started with event tracking

January 12, 2022 in Games | 13 min. read
Unity, branded image with no logo
Unity, branded image with no logo

Is this article helpful for you?

Thank you for your feedback!

If you’re totally new to analytics in general, we highly encourage you to start with our introductory post for an overview of what it is and why it’s important to use data to refine your design, player experience, and revenue.

It’s not enough to simply put out a new game or content. Your team needs to ensure that proper updates are being released in order to improve the players’ overall experience. This is where event tracking comes in. Event tracking allows you and your team to ensure various pain points are being monitored constantly. From the first-time user experience (FTUE) to level difficulty, this article will focus on highlighting the various ways you can perform event tracking. 

1. What do I need to track in my game?

Whenever you design something in your game, you should always have an intention – a reason that is driving you to do it. However, the real challenge is making sure you are doing things for the right reasons, and for that you need to understand all the ways players interact with your game.

While you can make changes based purely on what you think is best, it never hurts to get some data in your corner so you can make more informed decisions on where to take your game.

Here are some common issues that might be on your mind that event tracking can help with:

  • How difficult is this level?
  • Is my tutorial easy to follow?
  • Have a lot of players purchased this cheap offer? 

If you wanted to find out if a level is challenging enough, you could track player death, where they die in the level, how many tries it takes on average to complete the level, how long it takes, what are the most popular items used to finish, and other relevant metrics to get a better grasp of how people are playing your game.

At this point, you might be asking how to go about tracking these things in your game, so it is time to discuss custom events and parameters.

2. Custom events and parameters

A custom event is the action or the result of an action by a player or your system in your game. Virtually, an event can be anything and everything you want:

  • A player finishes a dungeon
  • A player joins a guild
  • An offer is displayed to players
  • A player buys something

Once you create a list of events for your game, you can use parameters, which are just details of the event that give you specific information, to start tracking. For example, if a player finishes a dungeon, this event would be called dungeonCompleted.

Some example parameters, depending on what you want to learn, could be:

  • dungeonName: Indicates which dungeon was finished
  • time: Indicates how long it took for the player to finish the dungeon
  • playerHealth: Indicates the health of the player at the end of the dungeon
  • potionsUsed: Indicates how many potions the player consumed to finish the dungeon

Here is how this will actually look inside Unity Analytics:

Screenshot of the userAssignment view in Unity Analytics

However, be careful not to make every single thing an event and check whether any new element you want to track could actually be a parameter inside an already existing event.

This will make creating visualizations easier and unclutter your event schema. An example of this would be the missionCompleted event, which should have the parameters missionName, missionID, etc.

3. Standard events

Standard events are needed in every game and are used to record essential information on player activity and the game state.

The good thing about Unity Analytics is that it collects most standard events automatically once you have integrated the SDK into your project (see details below on trigger type). In addition to being collected automatically, these standard events are used by your default dashboards and metrics that you can use in the Data Explorer.

These standard events include:

Event NameDescriptionTrigger type
newPlayerSent when a new player installs the app on their device.Auto
gameStartedSent at the start of a new session. A new session starts when the user first launches an app or starts a new session after more than 30 minutes of inactivity.Auto
gameEndedSent when a player exits the game or no session activity is detected.Auto
gameRunningSent periodically when the app is running to detect session activity.Auto
clientDeviceRecords the first time a user launches an app and when device information changes.Auto
ddnaForgetMeRecords when a player opt outs of data collection via the privacy plugin.Auto
transactionSent when a player makes an in-app purchase and tracks the purchase amount. Transaction validation can be done via the Unity IAP.Manual & Auto for IAP when using Unity IAP
adImpressionAvailable to be sent manually when a player has been shown an ad within the game.Manual
sdkStartSent when the SDK initializes.Auto
notificationOpenedSent when a push notification is opened or a notification was received while the game is in front.Auto
notificationServicesRecords the player’s push notification tokens.Auto
outOfGameSendSent when a push notification is sent to a player.Auto from Player Engagement
userAssignmentAutomatically assigns a player to a campaign for reporting.Auto from Player Engagement

Tip: You can add custom parameters to standard events so you don’t have to create others if you need custom details on standard events.

4. Common tracking scenarios

First-time user experience (FTUE)

One of the simplest ways to track how engaged new players are is to check how many complete the tutorial. To do this, you would need to create the standard event newPlayer and one custom event that will trigger once a tutorial step is completed, such as tutorialStepCompleted with the parameter stepID to indicate the ID or name of the step.

If you want more granularity in your tutorial analysis, you can also add an event that tracks when the tutorial begins so you can determine if it is beginning properly for players. You can also add an event when the tutorial ends or when any step is started to follow every second of the player journey in the tutorial.

The more custom events you add to track within the FTUE, the more you can understand user drop off and what needs to be tweaked to create a more engaging experience for your first-time players.

An item is bought

For every virtual or real currency transaction in the game, you should always use the transaction standard event and add custom parameters to accommodate your needs. The transaction standard event is then used to populate the revenue dashboard and metrics in the Data Explorer.

You can validate your revenue using the transaction event and the Unity IAP plugin. The transaction event already has many useful parameters set up to register what the player spent, how much they spent, and what they received. All the parameters under productsReceived and productsSpent will help you with this.

When tracking purchases, it is imperative that you track them in USD as separate parameters as well as in your local currency in order to normalize data and have accurate revenue metrics. The transaction event is a standard event and can be either triggered manually by the customer or automatically fired if the Unity IAP is integrated into their game.

Let’s say you’re developing an RPG where the player can buy and receive heroes, gear, and resources from multiple points such as the shop, popup offers, or a daily reward system. The following parameters will help register most of the information for your transactions:

  • source: On which point the item was bought (shop, popup offer, daily reward) 
  • heroLevel: The level of the hero the player bought
  • gearLevel: The level of the gear the player bought
  • dailyRewardDay: If the reward is received from a daily reward, this will track the day number

If the player buys something in the shop, you could analyze how fast the user bought this item after seeing it for the first time with these parameters:

  • shopVisitTotal: Total visit of the shop in the player’s lifetime
  • shopVisitSession: Total visits of the shop in this session
  • offerImpressionSession: Total impressions of the offer this session
  • offerImpressionTotal: Total impressions of the offer in the player’s lifetime

Notice that some parameters like shopVisitTotal are a value stored over the player’s lifetime and helps you keep track of a user’s entire history in the game.

Feature adoption

Using both standard and custom events are key to measuring the success of new features within your game and how users adopt them.

For example, say we introduce guilds into the game, a feature which is very important for long-term engagement and player interactions, especially for RPGs. Implementing the following events would be important for tracking guild engagement:

  • guildJoined: User joins a guild
  • guildLeft: User leaves a guild
  • guildMessageSent: User sends a message in guild chat
  • guildRole: User has an admin role within the guild
  • guildGiftSent: User has sent a gift to a member of his guild

Analyzing each of these events will help you determine how active users are with the guild feature and this data can be combined with existing events to determine their overall engagement with the game.

One handy tip is to try comparing users who join a guild versus those who do not. Do guild players spend more money, play more often, or spend more time logged in? These are all key bits of information that you can use to help optimize everything in your game.

Player lifecycle

Tracking the user’s lifecycle throughout the game is important to determine when they stop playing or to identify any other issues with the game.

Some events that are useful for tracking player lifecycle are:

  • characterLevelUp: The current level of the user
  • Transaction: When a user makes a purchase
  • guildJoined: When a user joins a guild
  • currencyGained: Amount of in-game currency gained

Using a variety of these events will be useful in the long run as you can see how users are engaging with your game, when they stop playing, and other pain points that you need to change to create a better player experience.

Additionally, tracking transactions is important because spenders tend to be more engaged in the game and stick around longer. After all, they’ve made the decision to commit their wallet to your game, so you must be doing something right.

To wrap up, keep in mind these three rules:

  1. Whenever you have a design intention, verify it with data. Your players are the best resource you’ll ever need to know how to improve your game.
  2. Having too much data is always better than having not enough. Sometimes, implementing lots of parameters can seem cumbersome, but having historical data and lots of details is often a life-saver when new decisions and questions emerge.
  3. Less events, more parameters. Always ask yourself if a new event could actually be a parameter inside another event to help simplify your analysis and visualizations.
January 12, 2022 in Games | 13 min. read

Is this article helpful for you?

Thank you for your feedback!

Related Posts