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!
-TheNappingKat