Client-SideUnity SDKFeatures

Privacy Controls

Allow users to opt out of analytics

Version:

The SDK provides controls to respect user privacy preferences and comply with regulations.

Toggle Data Collection

Allow users to opt out of analytics:

// Disable data collection
AudiencelabSDK.ToggleMetricsCollection(false);

// Re-enable data collection
AudiencelabSDK.ToggleMetricsCollection(true);

// Check current status
bool isEnabled = AudiencelabSDK.GetIsMetricsCollection();

Behavior When Disabled

When data collection is disabled:

  • Events are dropped instead of being sent
  • No network requests are made to AudienceLab servers
  • When re-enabled, events are sent normally

Implementation Example

// In your settings UI
public void OnPrivacyToggleChanged(bool isEnabled)
{
    AudiencelabSDK.ToggleMetricsCollection(isEnabled);

    // Save user preference
    PlayerPrefs.SetInt("AnalyticsEnabled", isEnabled ? 1 : 0);
    PlayerPrefs.Save();
}

// On app start, restore user preference
void Start()
{
    bool analyticsEnabled = PlayerPrefs.GetInt("AnalyticsEnabled", 1) == 1;
    AudiencelabSDK.ToggleMetricsCollection(analyticsEnabled);
}

Compliance

Use this feature to comply with: GDPR consent requirements, CCPA opt-out requirements & App Store privacy guidelines