How to use analytics in Unity

Let’s go over how to enable and use analytics in Unity.

First, open the Services window, click on Analytics and then enable:

To view analytics events click on “Go to dashboard”. In older versions of Unity it was possible to view the events in the editor but that has now been removed:

Open up the script you want to track events on and add the using directive UnityEngine.Analytics:

Add a public function for the event and add Analytics.CustomEvent with a suitable description:

Lastly, add the script to a buttons OnClick event:

Good luck!