Integrating GameAnalytics into Unity

Fifth Mountain Studios
4 min readJan 17, 2021

--

by Carlos Zepeda Quintanar

We soft-launched our first game, Pafu, a physics-based puzzle mobile game now available for Android. We spent our last sprint — among other things — instrumenting our game using GameAnalytics(GA) and Facebook SDK and thought you might want to know how it’s done. But before that, let us clear some questions out of the way first.

Why instrumenting your game?

Short answer: Publishers.

While engaging in early conversations with a few publishing companies we encountered two reoccurring topics:

  • What are your game KPIs(DAU, Retention)?
  • Do you have instrumentation in place to perform an in-market test?

To both questions, our answer was: Not sure. Which clearly, was not great. The reality is that instrumenting your game will provide you with powerful insights, for example:

  • How often/long are customers playing?
  • Which levels are too frustrating?
  • What are the most/least used features?

Ultimately, it will enable you to have a data-driven development of your product and improve your game experience.

What platform should you use?

There are several instrumentation platforms out there (Facebook SDK, Unity Analytics, GameAnalytics and others). However, this time we will be focusing on GameAnalytics which we think is a good way to get you started on this space with a simple and powerful mobile game tool.

How to integrate GA into your Unity Game?

I will be onboarding Code Aces to GA. This is a mobile game originally developed by two of our peers — Harry Jackson and Diego Herrera — and now being transitioned to our FMS team.

First, you’ll need to create a GA account. Go to the GA website and register a new account. Then, add a new organization and game for your product (note that you will need to add a new game per game platform).

If your game is already available in an app store, you can search for it. Otherwise, you can go ahead and select “My game is not available in an app store”. This should prompt a new form, please add a Game Title and select a Game Platform. Fill out all the details for your game (genre, benchmark, etc).

Fill out the required details about your game.

You’ll land in a page with a Game key and Secret key. Copy and save these values - you will need them later.

Download the Unity SDK plugin. Import the package into your Unity project ​​(excluding the PlayServiceResolver folder).

Configure Game Analytics in Unity, go to: Window > GameAnalytics > Select Game Settings. This will prompt a form under the Inspector. You can login with your GameAnalytics account, this will make the process much easier. (Note: once you login, only the games created before you login will appear to set-up)

Add the Android/iOS platforms. Use the drop down to choose the game(s) you already setup on the GA website.

Create Game Analytics Game Object. Open your main Scene in Unity. Go to: Window > GameAnalytics > Create Game Analytics Game Object.

Finally, we’ll need to do some minor code integration. Go to your project, add the following lines of code to any script on a Game Object in the main scene that will be called during the launch of your game.

Build your game and deploy the changes (to an app store or install the binary into a device) so the events can start flowing. After launching the game you can navigate to the GA dashboard to visualize the incoming data.

GA Overview dashboard for CodeAces.

You have completed the integration of GA into your game, now you will be able to better understand your game performance and experience. There are other events supported by this platform (to track customer progress, monetization, errors, etc.) which we will be covering later, along with other analytics platforms. But for now, that’s all.

See you next time.

--

--