Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  4. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Completely disabling Analytics at runtime

Discussion in 'Unity Analytics' started by tcoles, Mar 7, 2018.

  1. tcoles

    tcoles

    Joined:
    Jan 30, 2018
    Posts:
    9
    I am attempting to completely disable Analytics data collection (for example, using preprocessor directives to ignore analytics in dev builds, and so on). If I try to set `Analytics.enabled = false`, it does indeed seem to stop my custom events from getting through, however the Validator still shows appStop and appRunning events.

    I've tried setting `enabled = false` in a MonoBehaviour's Awake method, as well as a static class' static constructor (although I can't find a better place to reference said static class than in another Awake method...) Is there a better place to set this?
     
  2. marc_tanenbaum

    marc_tanenbaum

    Unity Technologies

    Joined:
    Oct 22, 2014
    Posts:
    316
    Hi @tcoles,

    Are you a Personal, Plus or Pro user? Unity sends a set of events (including appStart, appRunning, etc.) that are not under developer control. We use these to gain understanding of games, devices, and the industry at large. They can be silenced for Plus and Pro users by going to Edit > Player Settings > Other Settings > Configuration > Disable HW Statistics.
     
  3. tcoles

    tcoles

    Joined:
    Jan 30, 2018
    Posts:
    9
    Pro. Even with Disable HW Stats checked, I still see appStop and appRunning firing.
     
  4. marc_tanenbaum

    marc_tanenbaum

    Unity Technologies

    Joined:
    Oct 22, 2014
    Posts:
    316
    I think you're doing a bit of a chicken/egg thing: if you turn on Analytics in order to check the validator, then by definition you're sending these events. :D (i.e., if analytics or any other service is on, all these "core" events get sent to our servers.)

    With HWStats off and all services disabled (including Analytics) your build will not send events. If you need confirmation of that, you can use a tool like Charles Proxy to confirm.

    Hope that helps!
     
  5. tcoles

    tcoles

    Joined:
    Jan 30, 2018
    Posts:
    9
    Ok, so I'm just trying to dig down to an answer I can take to the bank here... :)

    Since Services are per-project configurations, would it be true there is no way to enable Analytics only for certain builds (i.e., production builds), and completely disable it for other builds (i.e., QA builds) of the same project?
     
  6. marc_tanenbaum

    marc_tanenbaum

    Unity Technologies

    Joined:
    Oct 22, 2014
    Posts:
    316
    A team-member just pointed out to me that we have:

    https://docs.unity3d.com/ScriptReference/Analytics.Analytics-deviceStatsEnabled.html

    This will allow you to disable HWStats, provided (a) that the account performing the build is Pro, and (b) no services are enabled.

    Some further thoughts:
    • You could mark a script with [RuntimeInitializeOnLoad] to have it call as early as possible, presumably blocking any core events from sending.
    • You could potentially enable this script through a build-chain so that your Prod builds have it on, but your QA builds have it off.
    Personally, I'm a little leery of running your build-chain this way, since it means that by definition your QA builds aren't equivalent to the ones you're sending to your customers, but that's up to you and your team, of course.
     
  7. tcoles

    tcoles

    Joined:
    Jan 30, 2018
    Posts:
    9
    Thanks for the guidance. From my testing, it seems like setting`Analytics.enabled/deviceStatsEnabled = false` in a RuntimeInitializeOnLoad method doesn't necessarily stop all core events. But I'll admit I'm having a hard time saying anything certain about a system with some built-in uncertainty (in the form of events caching).
     
  8. marc_tanenbaum

    marc_tanenbaum

    Unity Technologies

    Joined:
    Oct 22, 2014
    Posts:
    316
    Good luck with it. I have one other idea...but I need to research it. I'll let you know if I come up with something more.
     
    tcoles likes this.
  9. dee7800

    dee7800

    Joined:
    Jul 25, 2013
    Posts:
    1
    pro user here:
    just looking at the system outputs i see the analytics system is still working
    maybe a different point than the guy above but it still shouldn't be doing this.

    i am in 2018.1.7
    i have disable hw statistics
    but i still see related file creation in the app persistent folder

    creating directory:
    Unity>xxxxxx>Analytics:
    -- config (updates on play)
    {"prefs":{}}
    -- values (updates on play and stop)
    {"config_etag":"","app_info_hash":748638352,"app_installed":true,"engine_ver":"2018.1.7f1","app_ver":"1.0","custom_event_time":0,"custom_event_count":0}

    being a statistician and having been in situations where a data point my cost thousands of dollars, i rarely give out data, especially to mass data collectors.

    this seems like it is fishing for a data point should the user happen to uncheck the box.

    its sad that the intel gathering has been reduced to users, whom have paid thousands of dollars, must continually opt out (every project you create) of data collection. i feel someone is just high on the data intelligence fad and using physiological techniques to produce more data over the long term. They are concerned with their own value over respect for their customer. as it is easy to disable a system (when designed decently and this is unity engineers). so ... when only parts get disabled great care must have been taken to not disable the whole thing.
     
  10. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,021
    @dee7800,

    Outgoing requests are only sent when HW Stats is enabled or a Service (Ads, Analytics, IAP, Multiplayer) is enabled.

    There is currently a known issue with 2018.1+ where new projects may have Analytics enabled, even if they marked as disabled when creating the project.

    To confirm that Analytics (and all other Services) are disabled, you can open the Services window and check the status of the Services. (Alternatively, you can check the UnityConnectSettings.asset in the ProjectSettings folder, if asset files are set to text serialization in your Editor settings.)

    If all Services and HW Stats Collection are disabled and you still see outgoing requests, please open a support ticket and we will investigate further.

    https://analytics.cloud.unity3d.com/support/
     
  11. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,111
    When will this be available for free users?

    It's a pretty untrustworthy thing to be doing to your users.