Get started with Analytics

To start using Analytics, perform the following actions:

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:

  1. In the Unity Editor, navigate to Window > Package Manager.
  2. Select Unity Registry.
  3. Search for Analytics (or com.unity.services.analytics).
  4. Select the package, then select Install.

You can now start using the Analytics SDK.

Collect data

To enable the Analytics SDK to collect data:

  1. 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.
  2. 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.

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:

  1. Go to cloud.unity.com.
  2. Select + under Shortcuts in the left panel.
  3. 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.