Documentation

​
​

Development

User Acquisition

Monetization

Industry

Analytics

Unity SDK

Client API

Analytics

LiveOps
​
​
Analytics
  • Overview
  • Get started
  • Pricing
  • Concepts
  • Tutorials
  • Reference
  • Privacy and consent
    • Privacy overview
    • Apple privacy manifest
    • Google data safety
    • Manage data privacy when using the SDK
      • SDK compliance: Opt in
      • SDK compliance: Opt out
  • FAQ
  1. Unity Analytics
  2. Manage data privacy with the SDK

Opt-in compliance

Learn how to request player consent for data collection in regions with opt-in requirements, such as China's Personal Information Protection Law.
Read time 3 minutes
Last updated 8 months ago

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.

Unity 6.2 and later with Analytics SDK 6.1 and later

The Analytics SDK is controlled by the Developer Data framework
EndUserConsent
API, present in the Unity Engine from 6.2 onwards. To start or stop data collection, you must set the consent status for
AnalyticsIntent
to
Granted
or
Revoked
respectively.
For specific information about granting consent with the
EndUserConsent
API, refer to Developer Data framework.

Unity 6.1 and earlier, or Analytics SDK 6.0 and earlier

Important
Unity Analytics requires you to implement a privacy solution separate from Unity Ads. If you're using both Unity Ads and Unity Analytics, the Unity Ads opt-out mechanism does not apply to both services.
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.

PIPL consent

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!

Copyright © 2026 Unity Technologies
LegalPrivacy PolicyCookiesDocumentation Terms of UseDo Not Sell or Share My Personal InformationYour Privacy Choices (Cookie Settings)

"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S and elsewhere (more info here). Other names or brands are trademarks of their respective owners.

Some pages are machine-translated for convenience, and may contain inaccuracies. In the event of conflicting information, the English version is authoritative.

  • On this page
    • Unity 6.2 and later with Analytics SDK 6.1 and later

    • Unity 6.1 and earlier, or Analytics SDK 6.0 and earlier

    • PIPL consent


Report a problem with this page