Analytics.limitUserTracking

切换到手册
public static bool limitUserTracking ;

描述

控制是否在运行时限制用户跟踪功能。

将此属性设置为 true 后,Analytics 服务将不会向游戏用户发送 SystemInfo.deviceUniqueIdentifier,从而进一步匿名数据。默认情况下,limitUserTracking 为 false。

using System;
using UnityEngine;
using UnityEngine.Analytics;

public class DataPrivacyOptInFlow { [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] static void InitStepOne() { Analytics.initializeOnStartup = false; }

public void EnableAnonymizingData() { Analytics.limitUserTracking = true; }

// Call this when the user has given limited data collection permission public void UserHasOptedIntoLimitedDataCollection_LetsResumeAnalyticsInitialization() { EnableAnonymizingData(); Analytics.ResumeInitialization(); } }