Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question App for Kids, how to totally disable HW stats and Analytics?

Discussion in 'Unity Analytics' started by Klamore74, Aug 29, 2022.

  1. Klamore74

    Klamore74

    Joined:
    Jun 17, 2013
    Posts:
    103
    I'm working on a Kid's app, and I need to disable any external web calls.

    I just want to use IAP on Unity 2021.3 LTS, and I get lost on many threads and changes on the analytics system with game-service.

    Please can Anyone help me to understand how to totally disable external calls? I also see I need to disable "hw statistics" in player settings, but I don't see it.

    Somewhere I get this code, but not sure is still valid:

    Code (CSharp):
    1.     [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
    2.     public static void OnRunTimeMethodLoad()
    3.     {
    4.         Analytics.enabled = false;
    5.         Analytics.deviceStatsEnabled = false;
    6.         Analytics.limitUserTracking = true;
    7.         try
    8.         {
    9.             PerformanceReporting.enabled = false;
    10.         }
    11.         catch (System.MissingMethodException)
    12.         {
    13.  
    14.         }
    15.     }
     
  2. Julian-Unity3D

    Julian-Unity3D

    Unity Technologies

    Joined:
    Apr 28, 2022
    Posts:
    192
    Hi @Klamore74
    Thanks for bringing this up.
    This is something that I will look into and get back to you on!
     
    Last edited: Aug 30, 2022
  3. Julian-Unity3D

    Julian-Unity3D

    Unity Technologies

    Joined:
    Apr 28, 2022
    Posts:
    192
    Can you confirm what version of IAP you want to use?
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  5. Klamore74

    Klamore74

    Joined:
    Jun 17, 2013
    Posts:
    103
    Hi,

    I'm using Unity 2021.3 LTS with IAP 4.4.1.

    I just enabled the IAP, and "legacy Analytics" showed up. I just do it yesterday, so I don't understand what you mean that is not available. Maybe I was in an older IAP version, and I updated after?

    Reading the infographics appear that Analytics can be untied from IAP.

    So, can I just disable it?

    Thanks
     
  6. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    It is not possible to enable legacy Analytics in new projects, you probably received an email to that effect. It probably looks like it's enabled in the Editor though but don't try to disable it. Ensure to read through that link I shared. IAP 4.4.1 is the latest version. Once you build your game, you can confirm what is being sent over the network by using Charles Proxy https://support.unity.com/hc/en-us/articles/115002917683-Using-Charles-Proxy-with-Unity
     
  7. Klamore74

    Klamore74

    Joined:
    Jun 17, 2013
    Posts:
    103
    Hi,

    I finally test with charles proxy and I note one only call to config.uca.cloud.unity3d.com

    What is that? Can I disable it?

    upload_2022-9-15_16-53-39.png

    Thanks,
    Moreno
     
  8. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    It looks like you still have Legacy Analytics in your project. Can you share a screenshot of Package Manager showing the packages in the project?
     
  9. Klamore74

    Klamore74

    Joined:
    Jun 17, 2013
    Posts:
    103
    Yes, I have the legacy analytics, but I don't know how to remove it.

    upload_2022-9-19_22-11-18.png
     
  10. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  11. Klamore74

    Klamore74

    Joined:
    Jun 17, 2013
    Posts:
    103
    Hi Jeff,

    As you can see in the package manager, no "Analytics Library" appears.

    As I wrote in the first place of this post, I disabled Analytics with the code you linked.

    But at the start of the application, a single call to "config.uca.cloud.unity3d.com" was made.

    How I can disable that? What is that call? I don't know what to say to my client or the Apple approval team.

    Please give me some help.

    Thanks
     
  12. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    If you can call that code, it means you have the legacy library installed. Instead of looking under Packages in Project, look under the Unity Registry and look for the green check. Also, you could try this method if you have the UGS Analytics package installed, look for SetAnalyticsEnabled

    https://docs.unity3d.com/Packages/c...ity.Services.Analytics.IAnalyticsService.html
     
  13. Klamore74

    Klamore74

    Joined:
    Jun 17, 2013
    Posts:
    103
    I try to disable via code both Legacy that UGS with this code, but I still have this call:

    upload_2022-9-20_12-26-27.png


    This is the code I use. And I'm sure that it is called because I see the debug log:

    Code (CSharp):
    1.     [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
    2.     public static void OnRunTimeMethodLoad()
    3.     {
    4.         Debug.Log("Disable all analytics");
    5.         AnalyticsService.Instance.SetAnalyticsEnabled(false);
    6.         Analytics.enabled = false;
    7.         Analytics.deviceStatsEnabled = false;
    8.         Analytics.limitUserTracking = true;
    9.         try
    10.         {
    11.             PerformanceReporting.enabled = false;
    12.         }
    13.         catch (System.MissingMethodException)
    14.         {
    15.  
    16.         }
    17.     }


    Any Idea another idea? This is very frustrating, I very near to the release, please help me :)
     
  14. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I don't see the call in my testing. Did you find and remove "Analytics Library"? It's not in my test project. If you can provide an unencrypted Charles capture, we could probably tell where this is coming from. You would need to add the package mentioned in the article. You would also be able to tell exactly what is being sent, it is likely only the projectID and no user information. Can you compare to a brand new project? Create a Charles capture before and after you add any packages.
     
  15. Klamore74

    Klamore74

    Joined:
    Jun 17, 2013
    Posts:
    103
    This is a detail of the call:

    Request

    Code (CSharp):
    1. {
    2.     "common": {
    3.         "appid": "f5251b40-772d-4a48-9c6c-e12e1434a163",
    4.         "userid": "daade7c9f328d8fa0bac7f96775456e8",
    5.         "sessionid": 6574538844233842516,
    6.         "platform": "AndroidPlayer",
    7.         "platformid": 11,
    8.         "sdk_ver": "u2021.3.4f1",
    9.         "sdk_rev": "cb45f9cae8b7",
    10.         "session_count": 37,
    11.         "localprojectid": "e8fd29c28cd22564e8118fb6ee7cb034",
    12.         "build_guid": "c90ec41e18510f140af5ed1e47150d2b",
    13.         "deviceid": "unknown",
    14.         "identity_token": "daade7c9f328d8fa0bac7f96775456e8",
    15.         "t_since_start": 4136380
    16.     }
    17. }
    Response:

    Code (CSharp):
    1. {
    2.     "prefs": {},
    3.     "analytics": {
    4.         "enabled": true
    5.     },
    6.     "connect": {
    7.         "limit_user_tracking": false,
    8.         "player_opted_out": false,
    9.         "enabled": true
    10.     },
    11.     "performance": {
    12.         "enabled": true
    13.     },
    14.     "dynamic": {
    15.         "coreBusinessMetrics": {
    16.             "enabled": true,
    17.             "timeToWaitForUserInfoS": 60
    18.         },
    19.         "analytics": {
    20.             "shouldCollectAutomation": true,
    21.             "timeToWaitForUserInfoS": 60
    22.         }
    23.     }
    24. }
    I have no chance of passing apple certification with that. Do you think to remove IAP, upgrading unity and re-install IAP can have some benefits?
     
  16. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    We've had users pass Apple certification for years with legacy Analytics, there is no private user data in the request. Did you find and remove "Analytics Library" and/or compare to a new project?
     
  17. Klamore74

    Klamore74

    Joined:
    Jun 17, 2013
    Posts:
    103
    I try to update my project to 2021.3.10f. I remove IAP and remove from package.manifest all reference to analytics.

    No package showed up on package manager about Analytics or IAP. I start the app and now I receive two type of call
    upload_2022-9-20_18-15-54.png

    upload_2022-9-20_18-16-23.png

    I cannot include any code to disable because no libraries are included. So by default Unity is sending session information.

    And "from many times we do so" is not an answer, privacy is not the same as in the past years. An in any case, in the past we got a wrong review on Steam for that. Now I'm risking having throble passing the "design for children" process.

    There is no personal information, but in the call, there is UserId, DeviceId, AppId, and SessionId. This is tracking, and I don't want that.

    I'm trying right now to put again the IAP hoping to link to UGS and not the older one. And I hope I can remove it.
     
  18. Klamore74

    Klamore74

    Joined:
    Jun 17, 2013
    Posts:
    103
    Upgrading Unity has no effect.

    I continue to view "Legacy Analytics," and I cannot unlink. I also prove to change the project id without any effect.

    upload_2022-9-20_18-41-11.png


    And a call before the disabling code was made.

    upload_2022-9-20_18-37-43.png


    Please help me out
     

    Attached Files:

  19. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Sorry for the confusion. I was suggesting to start with a new/empty project to compare. Why can't you unlink? Did you find it in Package Manager and attempt to remove it? It should not be present in new project. If you are seeing that web call, Analytics Library is indeed in your project in Package Manager, I trust you looked under "Unity Registry" also. Another thing to try is to edit /ProjectSettings/UnityConnectSettings.asset and ensure all the settings are 0 for UnityAnalyticsSettings.
     
    KarabinMax likes this.
  20. Klamore74

    Klamore74

    Joined:
    Jun 17, 2013
    Posts:
    103
    I just start from a new project, and I got the same results, BUT editing UnityAnalyticsSettings works!

    I want to thank you for your support. I know that is incredibly hard to follow that huge combination of versions and configurations. And sorry to be so pressing, I was very worried about that.
     
    JeffDUnity3D likes this.
  21. spilat12

    spilat12

    Joined:
    Feb 10, 2015
    Posts:
    38
    Similar story in Unity 2022.3.14f1, I've got nothing in the Package Manager, nothing in the Project Settings, yet UnityAnalyticsSettings in UnityConnectSettings file had m_Enabled: 1 and m_InitializeOnStartup: 1.
     
    mylastggeast and kedronic like this.
  22. mylastggeast

    mylastggeast

    Joined:
    Jun 14, 2021
    Posts:
    41
    Unity 2022.3.19f1, this fixed it for good. Many thanks
     
    spilat12 likes this.