Opt-out compliance
Important: Unity Analytics requires you to implement a privacy solution separate from Unity Ads. So, if you're using both Unity Ads and Analytics, the Unity Ads opt-out mechanism does not apply to both services.
All versions of the Analytics SDK provide compliance mechanisms consistent with known regulatory customers and guidance including General Data Protection Regulation (GDPR) and California Consumer Privacy Act (CCPA).
In regions that require you to provide an opt-out, you must provide your own logic to determine whether the player has opted out. You may call AnalyticsService.Instance.StartDataCollection()
to start the SDK if the player hasn't opted out, otherwise you shouldn't call it and the SDK remains dormant.
async void Start()
{
await UnityServices.InitializeAsync();
if (playerHasOptedOut)
{
// Do nothing, leave the SDK off
}
else
{
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!