Expert: How to Integrate GameAnalytics in Unity (Part-1)

Shiddalingeshwar M S
4 min readMay 13, 2021

GameAnalytics by default works out of the box providing you with the metrics that is DAU, Session length and Retention will be shown on the platform. GameAnalytics proves you with the ability to create own custom events depending on what you would prefer to track in your game.

Introduction

In this article, we will learn GameAnalytics integration in Unity Game. GameAnalytics by default works out of the box providing you with the metrics that is DAU, Session length and Retention will be shown on the platform. GameAnalytics proves you with the ability to create own custom events depending on what you would prefer to track in your game. It also provides following events as listed below, in this article I will be covering following events : Design Events, Progression Events, Business Events and Error Events.

1. Design Events: Custom events

2. Business Events: Monetization, transactions

3. Resource Events: Virtual currency spending

4. Progression Events: Levels, attempts, scores

5. Error Events: Critical, warning, debug

Development Overview

You need to install Unity software and I assume that you have prior knowledge about the Unity and C#

Hardware Requirements

  • A computer (desktop or laptop) running Windows 10.
  • Android phone with API Level 21 or latest and USB cable, which is used for debugging.

Software Requirements

  • Java JDK 1.7 or more installation package.
  • Unity software version: 2020.1.15f1.4895 or latest installed.

Integration Preparations

  1. Create Unity project.

2. Download GameAnalytics plugin.

3. Click Assets > Import package > Custom package select GameAnalytics package file and click OK.

4. Add following permissions in AndroidManifest and other required permissions.

5. Add game key and game secretselect Window > GameAnalytics > Select settings login with your credentials.

Once you click on Select settings, it will create GameAnalytics Object automatically, if not created you can create by selecting Window > GameAnalytics > Create GameAnalytics Object.

How do I trigger Design Events?

Basically design events are triggered on click of the UI components like button that you would like to trigger the event like START button on click, You can add Design event, for that you can use following code.

How do I trigger Progression Events?

Progressions events as name itself indicates these events are meant to be started or triggered whenever progression in the game happens like Level up, it is purely based on your game progression design model. You can use the following code to trigger this event.

How do I trigger Business Events?

Business Events are used to track the real money transactions in your game. With the business event, you can include information on the specific type of in-app item purchased, and where in the game the purchase was made. For example

How do I trigger Error Events?

Error Events basically track the Error event to log errors or warnings generated by your player’s in-game behaviour. Following code triggers the Error Event in the game. Based on the severity of the error you can code accordingly.

Example:

Result

Tricks and Tips

  • Make sure you have downloaded latest plugin.
  • Make sure that GameAnalytics Object is created.
  • Make sure that required permissions are added in Manifest.

Conclusion

In this article, we have learnt how to integrate GameAnalytics in Unity. Which proves you with the ability to create own custom events depending on what you would prefer to track in your game. In next part, that is Part-2 I will be covering Resource Events and Ads Events and other features, stay tuned.

Thank you so much for reading, I hope this article helps you to understand the GameAnalytics features in Unity.

Reference

GameAnalytics

GameAnalytics Unity

GameAnalytics Plugin

--

--