Search Unity

Disabling Analytics (inc. sub-systems) at Runtime

Discussion in 'Unity Analytics' started by PeachyPixels, Feb 4, 2020.

  1. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    713
    Hello Everyone,

    I'm developing a component that centralises all data privacy logic to allow enabling\disabling of Analytic systems & sub-systems at runtime. That is, GPDR, CCPA, analytics, performance & error reporting.

    I've scoured the Unity documentation and this forum and think I've come up with the correct answers.

    To disable Analytics completely this is being used...

    Code (CSharp):
    1. Analytics.enabled = false;
    (in conjunction with Analytics.initializeOnStartup = false; and [RuntimeInitializeOnLoadMethod])

    To disable 'Personalised Analytics' this is being used...

    Code (CSharp):
    1. Analytics.limitUserTracking = true;
    2. Analytics.deviceStatsEnabled = false;
    To disable 'Personalised Advertising' this is being used...

    Code (CSharp):
    1. MetaData gdprMetaData = new MetaData("gdpr");
    2. gdprMetaData.Set("consent", "false");
    3. Advertisement.SetMetaData(gdprMetaData);
    4.  
    5. MetaData ccpaMetaData = new MetaData("privacy");
    6. ccpaMetaData.Set("consent", "false");
    7. Advertisement.SetMetaData(ccpaMetaData);
    And to disable performance reporting, this is being used...

    Code (CSharp):
    1. PerformanceReporting.enabled = false;
    But I can't seem to find out how to disable error reporting. I've seen the class CrashReportingSettings but this requires UnityEngine.CrashReporting which fails the build under Win32.Standalone

    I would be hugely grateful if someone could confirm the above is all that's needed and also point me in the direction of disabling error reporting at runtime please.

    PS: I'm aware there is currently a bug in IAP that is still leaking analytics events even when it's disabled, so waiting on a fix for that before fully testing.
     
    Last edited: Feb 4, 2020
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Can you share your current Charles Proxy capture? What is being sent? From what you've posted, I would only expect to see the IAP events that you mentioned. I believe error reporting IS Performance Reporting now.
     
    PeachyPixels likes this.
  3. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    713
    Thanks Jeff. There was actually a typo in my original message, it should have said Analytics instead of IAP in the PS. I've been tracking the Analytics bug you've been discussing in the relevant forum that is causing apps to be rejected on Apple. Once that's fixed, I'll test all the above and confirm.

    It sounds like you're also saying Performance Reporting will also disable Error Reporting as well, great. I'll test that at the same time. Thanks for clarifying.

    As for disabling Analytics and privacy in general, would you say the above has everything covered?
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Confirm with Charles Proxy to be sure.
     
  5. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    konsti1994 and Moonjump like this.
  6. TomTheMan59

    TomTheMan59

    Joined:
    Mar 8, 2021
    Posts:
    356
    Hi JeffDUnity3D,

    This is extremely concerning. I want to disable analytics for privacy reasons and it seems your code will also disable in-app purchasing.

    This is what it says in the services tab in unity.

    Screen Shot 2022-03-09 at 8.36.55 AM.png
     
  7. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    That is correct. However, see the post right above yours for the solution