Opt-in compliance

Important: UGS Analytics requires you to implement a privacy solution separate from Unity Ads. If you're using both Unity Ads and UGS Analytics, the Unity Ads opt-out mechanism will NOT apply to both services.

Some jurisdictions, including China where PIPL applies (more information below), are opt-in based legislations, regardless of whether the analytics are privacy invasive or not. For China specifically, players need to opt in to both the collection of their data and the transferring of their data outside of China. If a user is currently in China, you must request user consent.

Note: If you're using the REST API, refer to recording an event with the REST API.

If consent is given call AnalyticsService.Instance.StartDataCollection() to enable the collection of their data. If consent is not given, don't call this method and the SDK will continue to ignore events.

Note: Legacy versions (below version 3.0) of the SDK no longer collect data from users in impacted regions, strictly based on geographic location. No aggregated historical data is lost, but you will see a decline in core metrics such as DAU if you have players in these regions.

Warning: 3.x and 4.x versions offer developers functions to pass the appropriate consent flags to the Analytics package for players to opt in to data collection. These functions have been deprecated as of 5.0.0 and are no longer recommended for use. You should migrate to version 5.0.0 or newer as soon as possible. For more information, see the SDK 5.0.0 migration guide.

China's data privacy law - Personal Information Protection Law ("PIPL") - came into effect on 1 November 2021. Personal information is data that can identify a person, such as name or address, and is stored electronically or otherwise. Sensitive personal information refers to biometrics, gender identity, religious beliefs, medical history, finance, and any personal information of minors under fourteen years.

Please visit Unity's legal site for more information on Unity's approach to PIPL.

PIPL is an opt-in based legislation. You're obligated to ask the user for their consent before any other actions are allowed in the SDK. Call the StartDataCollection() method as seen below to signal that consent has been provided.

async void Start()
{
   await UnityServices.InitializeAsync();
   
   ShowPIPLConsentFlow();
}

public void PIPLConsentGiven()
{
	AnalyticsService.Instance.StartDataCollection();
}

Note: these API methods changed in version 5.0.0 of the SDK. Please ensure you have the latest version of the SDK installed!