Disable Advertising ID (AAID) collection runtime in Unity Firebase SDK

Viewed 624

screenshot

The new Google policy requires app to not transmit Android Advertising ID when targeting for both children and adults. Is there any option that we can disable it in runtime based on user preference? I found only this doc about disabling the AAID permanently using meta-data in AndroidManifest.xml https://firebase.google.com/docs/analytics/configure-data-collection?platform=android. I'm currently using Unity Firebase SDK at the moment and it does not seem like there's an option for it nor Android native Firebase SDK.

1 Answers

You can find this used in Firebase unity sample MechaHamster in Startup.cs file, here how they used it:

 // Start gathering analytic data.
    void InitializeAnalytics() {
      Firebase.Analytics.FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);

      // Set the user's sign up method.
      Firebase.Analytics.FirebaseAnalytics.SetUserProperty(
        Firebase.Analytics.FirebaseAnalytics.UserPropertySignUpMethod,
        "Google");

      if (CommonData.currentUser != null)
        Firebase.Analytics.FirebaseAnalytics.SetUserId(CommonData.currentUser.data.id);
    }
Related