Unity Analytics
Objective: Set up Unity Game Services Analytics for the project
In Unity select Window -> General -> Services to open the services window. If you have not set up Services then go to project setting under Unity’s edit menu and select an organization and create a project ID. After linking project you will be prompted if the app is targeting children under 13, in this case select no and save project settings.
Notice that Legacy Analytics has replaced Unity Analytics, which is now a part of Unity Game Services.
Click on Dashboard in the upper right, and sign into Unity. Join the open beta for Unity Game Services to get access to Analytics. Go to your project settings in the dashboard for Unity Game Services and download the SDK. Next select Analytics and click on Generate Code Snippet, following the instructions below.
Select the Edit menu in Unity and select Player Settings, choosing Services. Link the project to Unity Services. Next create a new game object and name it Game_Manager then add a new script called Game Manager with the code shown below.
In the Unity Game Services dashboard, go to the event manager and create a new event, case_Submitted, under Analytics for your project . Select parameters tab and add a Boolean parameter, Case_Submitted. Go back to the case_submitted event and add this new parameter.
Select the Submit_Button, which is a child of the Overview_Container. Create a new script, AnalyticsTracker, to the Submit_Button with the code shown below. This code creates a parameter dictionary with a reference to the Case_Submitted parameter created above. The CaseSubmittedAnalytics() method calls the custom event case_Submitted using the parameter dictionary to set the bool to true.
Now modify the On Click() event for the Submit_Button to call the CaseSubmittedAnalytics() method on the AnalyticsTracker script, shown below.
Unity Game Services is now tracking every time the user clicks the submit button.