Get started with Analytics
To start using Analytics, perform the following actions:
- Meet all the prerequisites.
- Install the Analytics package.
- Manually start the Analytics SDK to start collecting data.
- Set up Analytics.
Prerequisites
Before you continue, make sure you meet the following requirements:
- You have completed the steps outlined in Get started with UGS.
- You are using a project with Unity 2021.3 or above.
Note: Analytics is compatible with the following operating systems and platforms: iOS, Android, Windows, macOS, and WebGL.
Install the Analytics package
To begin using the Analytics SDK, install the Analytics package:
- In the Unity Editor, navigate to Window > Package Manager.
- Select Unity Registry.
- Search for Analytics (or com.unity.services.analytics).
- Select the package, then select Install.
You can now start using the Analytics SDK.
Collect data
To enable the Analytics SDK to collect data:
- Call the
UnityServices.InitializeAsync()
function at the start of your game to initialize the Analytics SDK and any other UGS SDKs that you have installed. - Once you confirm you have player consent, call
AnalyticsService.Instance.StartDataCollection()
to enable data collection.
Note: For the SDK to collect data, you must confirm that the user has consented to the use of Analytics. For more information about managing privacy and obtaining player consent, refer to Manage data privacy with the SDK.
Change player consent status
You can change a player's consent status using the following methods:
- To opt a player out of data collection, call the
StopDataCollection()
method. - To delete player data, call the
RequestDataDeletion()
method. - To opt a player in for data collection (again), call the
StartDataCollection()
method.
Important: You must call StartDataCollection()
at the start of each session to enable data collection. The SDK doesn’t track player consent status between sessions.
When you've enabled data collection, the SDK begins collecting events and uploading them at a regular cadence of every 60 seconds 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. To learn which events the SDK sends automatically and which ones you must configure manually, refer to Standard Events.
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 it to open Analytics. Analytics is now pinned under Shortcuts.
When you launch Analytics for the first time, it appears in the Shortcuts section on the sidebar and opens the Game Performance page.
Note: Only Organization Owners can sign up for Analytics.
Next steps
Refer to the following tutorials to learn how to build and record your own events:
Note: To learn about how the SDK works, refer to SDK behavior.