Legacy Documentation: Version 5.1
Import the Downloaded Package (SDK)
Attach Script to GameObject (SDK)

Create Script to Start a Player Session (SDK)

Create a new C# script by going to Assets->Create->C# Script. Name the newly created script UnityAnalyticsIntegration (This naming is important for the code snippet below to work correctly).

Open Script and Copy Code

Open your newly created script in MonoDevelop by double-clicking on the script. Completely replace the default generated code with the code below.

The projectId that you see in the sample code below is your unique Unity Analytics project’s ID and should be copied into your script. It is used to link your app to the project you create in the dashboard.

Note: This projectId below is not auto-generated. This is dummy text to let you know where to place your projectId after you create a project.

using UnityEngine;
using System.Collections;
using UnityEngine.Cloud.Analytics;

public class UnityAnalyticsIntegration : MonoBehaviour {

    // Use this for initialization
    void Start () {

        const string projectId = "PROJECTID-GOES-HERE-66fb5cf028d728bb";
        UnityAnalytics.StartSDK (projectId);

    }

}
Import the Downloaded Package (SDK)
Attach Script to GameObject (SDK)