Implementing Analytics in Unity

So in Part 1 of Unity Gaming: Analytics, I talked about the importance of analytics, what it is, why you would need them, and how to understand the data. This part will go over how to integrate them into your game and connect to the Unity Analytics Dashboard. Remember these new analytics are still in Beta and can only work with Unity 5.2 or above. Let’s get started.

Step 1: Sign-Up

Make sure you have a Unity Account before you get started. You will also need a Unity Services account as well. To get one go to https://unity3d.com/services/analytics to sign-up and try the free beta.


Step 2: Enable Unity Services

Now that you have an account you need to open your game in unity. In the upper right hand corner of the Editor you should see the unity services tab (if you don’t see the tab, hit the cloud icon in the upper right).


Before you can enable start using analytics you need to create a Unity Project ID so you can collect your data and view it with Unity’s Analytic Dashboard.

Select “Create” to have Unity create a Unity Project ID (if you already created a project ID in the Analytics Dashboard tool, you can use that ID to connect to your game with the “I already have a Unity Project ID link below the Create button).


Step 3: Enable Analytics

After you’ve turned on services and connected generated your Unity Project ID. You should see the available services that Unity provides within the Editor. Currently Analytics and Ads are the only ones available, however multiplayer options and Cloud Build are in the pipeline for future integration and use with the editor.

Turn on Analytics by clicking the “Off” toggle to “On” for analytics.


The Services tab will then open to the Analytics portion. Click the “Enable analytics


Step 4: Analtyics Integration and Validation

To view and test your analytics you now need to go to the Analytics Dashboard found online at https://analytics.cloud.unity3d.com. The easiest way to get there is to click on “Go to Dashboard” (make sure you’re connected to wifi).


The link will open your default browser and navigate you to the integration tab on your Unity Dashboard.


To find out if your Analytics Services are correctly integrated, navigate through the documentation, by clicking the Next button. You’ll see a “Play to Validate” page.

Go back to your application and Play it in the editor. The empty box on the Dashboard should now be displaying data about your game.


Trouble Shooting

If there is no data being displayed, stop your game and give the system time to refresh the dashboard. If it still isn’t working make sure that the Project ID in the Dashboard and the Project ID in the editor are the same.

Step 5: Write Custom Events

Now all that’s left to do is figure out what data is important to learn how users are interacting with your game. The next post will explain how to write code to collect custom information specific to your game/application.

Happy Coding!



The Importance of Analytics

Analytics are one of the cheapest ways you can increase profit in your game.

When should you Implement?

You’ve created a good playable game, but haven’t released it yet. That’s when you should add analytics.

Also when you ask yourself: Which type of player spends the most money? Is it Americans, older players, ones that struggle to complete levels? When do my players stop playing my game? How long do they play? Why aren’t they spending money on my game?

Why do you need them?

In order for you to take your game to the next level you need to know about your game. More specifically, how your users play your game. It’s nearly impossible to make any good decisions about how to continue development if you don’t have any information to go off of.

Anayltics implemented well, will give you all information you need to learn about who’s staying in your game, who’s stuck and who’s spending money and why. That last one is one of the most important. Game developers can then use those insights to make data-driven decisions to make players love your games even more.

And when users love your game, they are more willing to spend money by buying expansions, in app purchases or play more which means…watch more ads, getting you more money.

What are Analytics

Analytics are event triggers that you’ve implemented at certain points/milestones/areas in your game. They can tell you almost anything about your users. For example, these triggers can tell you: where a player goes in your game; how often they go there; whether or not they collect particular items and special achievements; or which level they die on.

Unity is great because it provides an easy to use and easy to understand Dashboard to visualize your games data.

Unity Dashboard – Metric Monitor


The picture above shows the main Metric Data that Unity provides for your game. I’ll explain the most common terminology used in the dashboard but the whole glossary of terms can be found here: Unity Glossary of Metrics.

Sessions – how many times your users play your game per week

DAU – Daily Active Users

MAU – Monthly Active Users

Retention – The percentage of average sessions per week

You can also modify what data you collect and display it on a chart in the Data Explorer Tab.

Data Explorer

By default Unity provides metrics on Player Data, Session Data, Retention Data, and Revenue. In chart Below I’ve customized my view to look at: Player Data – MAU; Session Data -Total Daily Play Time; Retention Data – Classified by geo location in the U.S., and a Custom Event that I created in my Game – Bubble Collected. Having this much data in one chart doesn’t really tell me too much though. I’ll talk about how to read data later in the post.



Funnels help you identify where drop offs happen in your game aka, when users stop completing a series of events. They are based of custom events that you create in your game. Funnels data is slightly different than regular metric data, in that it needs to be linear. What does that mean? Well when making your custom events the player needs to complete custom event 1, before completing event 2, in order for the data to show up on the funnel. The best example of this is level completion. In the picture below you can see that only 2.4% of users finish the game, and that 100% of users complete level 1 but then drops to 70% at level 2, but then drops drastically to 38% at level 3.



Segment data is used to qualify/organize users based on certain metrics. For example grouping users by location; how much money they spend in your game; how long their session time is, or by age groups. Based on these certain criteria, you can analyze what types of users are completing your game or which ones are spending money.

How do I read this data

Well understanding what you are collecting is very important. Looking at my mock data I can tell that users initially spend money, but my retention for the game is non existent, so users are no longer spending money in the game since they aren’t playing it.

I can then look at my funnel data and see that 100% of users are completing my 100% of the levels. Meaning 1)The levels are too easy, and I should make them harder. 2) I should make more levels so the users stay in the game longer and end up playing multiple times. 3)I need to create new incentives to bring players back into the game.

Alright now how do you implement the analytics in your game? Well that will be in my next post (Unity Gaming: Analytics (part 2))

Happy Coding!



Infinite Runner – Unity 5 Using Your Body as the Controller


As you know (or are just know learning) the Unity Gaming series on this blog is stepping through how to create a 3D Infinite Runner with Oculus Integration and Kinect Controls! Here’s a video explaining about it below.

Well, there is good news. UNITY 5.2 was released! And as such I’ve decided that this series would be perfect for exporing 5.2’s new features. Thus, the series has been re-vamped for Unity 5! (Well 5.2)

This post will highlight the major changes so you can integrate Kinect and Oculus into your Project!

So let’s get coding!

Unity Changes

This section will walk through all the changes that affect the Infinite runner I’m showing you how to create. This way when you follow along with Unity Gaming Series the code will work in unity 5.2.

Visual Studio

So if you download the new Unity 5.2 you’ll now notice that Visual Studio is now included! This is perfect for development debugging and building for Windows 10.

Oculus Integration AND Windows 10

The awesome thing about Unity 5.2 is optimization for Windows 10, Oculus Rift and other VR/AR devices!


The Code

Create Your Own

The Unity Gaming series was meant to walk you through creating an infinite runner from scratch; teaching good coding practices along the way. You can go back to the beginning with the first post: Unity Gaming: Good Practices Unity

Completed Infinite Runner Game

If you’re only curious in the Kinect and Oculus portion you can start from a completed infinite runner game. The code for the game is on my github here: Base Unity 5 Infinite Runner Game

Here are the step by step guides to integrate:

Completed Game with Oculus and Kinect

If none of those appeal to you and you want to download the whole thing. The link to the completed repo is here: Gravity Infinite Runner

Happy Coding!



Hey Everyone!

With Unity 5.2 out and all the cool new features with Virtual and Augmented Reality. I thought I’d do a quick tutorial about how to integrate Oculus into your Unity 5.2 or higher project. I’m walking through set up for a windows machine.

Step 1: Download

Go to Unity’s Home page and download Unity 5.2. Then go to the Oculus websites downloads section. Download the SDK, Runtime, and Utilities for Unity.


Step 2: Unity Plugins

Import the Oculus Plugin for Unity. In your Unity Project go to the Menu and select Assets>Import Package>Custom Package

In the File Explorer Select the Plugin you downloaded from the Oculus website.


Step 3: Oculus Prefab

Drag the Prefab into your scene, or the camera rig onto your character.


Step 4: Enable VR development in Unity

The newest and most important step – ENABLE VR FOR THE EDITOR! Do this by going to Player Settings and selecting the box for Virtual Reality Development


Now run the Game. It should exactly the same. But if you have an Rift set up the it will mirror the Unity Editor Game View.

And there you have it. Complete integration =)

Happy Coding!