Get started with Analytics
To get started, you need to:
- Sign up for UGS.
- Link your dashboard project to a Unity Editor project.
- Initialize UGS in your game code.
- Refer to billing information.
Sign up for UGS
If you don't have a Unity account, refer to Unity organizations and Get started with UGS to sign up for Unity Gaming Services.
Important: Only Organization Owners can sign up for Analytics.
- Sign in to the Unity Cloud Dashboard.
- Select Sign Up in the top banner and follow the instructions.
Set up Analytics
To set up and manage Analytics from the Unity Cloud Dashboard:
- Go to cloud.unity.com.
- Select + under Shortcuts in the left panel.
- Search for Analytics and select to pin to the left.
- Select to open Analytics.
When you launch Analytics for the first time, this adds Analytics to the Shortcuts section on the sidebar and opens the Game Performance page.
Link your project
To link your local project build to your Unity Cloud Project in the Unity Editor:
- Go to Edit > Project Settings > Services.
- Log in with your existing credentials.
- Select your project from the drop-down list and select Link project ID.
Note: The Services > Analytics settings page relates to Unity Legacy Analytics, not the new Gaming Services Analytics. You don't need to enable the Analytics settings on that page.
SDK installation
To install the latest Analytics package for Unity, use the latest version of the Unity Editor and follow these steps:
- In the Unity Editor, open Window > Package Manager.
- In the Package Manager, select the Unity Registry list view.
- Search for Analytics, or locate the Analytics package in the list.
- Select the package, then select Install.
Refer to the Package Manager documentation for more information.
SDK setup
Even though it has been installed, the SDK must still be started manually before it will begin collecting data.
First, call the UnityServices.InitializeAsync()
function at the start of your game to initialize the Analytics SDK and any other UGS SDKs that you have installled.
As the game developer, you are responsible for the player's privacy. Data won't be collected unless you inform the SDK that the player has consented to the use of analytics.
Note: For more information about managing privacy and obtaining player consent, refer to the Privacy overview.
Once you confirm you have player consent, call AnalyticsService.Instance.StartDataCollection()
to enable data collection.
You can change the player's consent status at any time using the following methods:
- If a player wants to opt out, call the
StopDataCollection()
method. - If a player wants to delete their data, call the
RequestDataDeletion()
method. - If a player wants to opt in (again), call the
StartDataCollection()
method.
After you enable data collection, the SDK begins collecting events and uploading them at a regular cadence while your game is running.
The SDK records some events automatically, so that you can go straight to Analytics in the Unity Cloud Dashboard to start analyzing your data.
Now that the SDK is up and running, see our tutorials for building and recording your own events:
To learn about what the SDK does behind the scenes, refer to SDK behaviour.
Important: Note that StartDataCollection()
must be called at the start of each session to enable data collection. The SDK won't remember the player's consent status.