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

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:

    [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
    public static void OnRunTimeMethodLoad()
    {
        Analytics.enabled = false;
        Analytics.deviceStatsEnabled = false;
        Analytics.limitUserTracking = true;
        try
        {
            PerformanceReporting.enabled = false;
        }
        catch (System.MissingMethodException)
        {

        }
    }

Hi @Klamore74
Thanks for bringing this up.
This is something that I will look into and get back to you on!

Can you confirm what version of IAP you want to use?

@Klamore74 HW Stats was only available prior to Unity 2019. The code you shared is for legacy Analytics which is now deprecated and not available for new projects. If this is an existing project with legacy Analytics, then the code above would work. IAP now recommends UGS Analytics but it not required, this has more info FAQ for IAP 4.2+ and adoption of UGS Services

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

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

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?

Thanks,
Moreno

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?

Yes, I have the legacy analytics, but I don't know how to remove it.

8450876--1121048--upload_2022-9-19_22-11-18.png

You would see “Analytics Library” in Package Manager if you have legacy Analytics. This may help if you want to try to disable it at runtime https://docs.unity3d.com/ScriptReference/Analytics.Analytics-enabled.html

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

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/com.unity.services.analytics@4.2/api/Unity.Services.Analytics.IAnalyticsService.html

I try to disable via code both Legacy that UGS with this code, but I still have this call:

8452247--1121351--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:

    [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
    public static void OnRunTimeMethodLoad()
    {
        Debug.Log("Disable all analytics");
        AnalyticsService.Instance.SetAnalyticsEnabled(false);
        Analytics.enabled = false;
        Analytics.deviceStatsEnabled = false;
        Analytics.limitUserTracking = true;
        try
        {
            PerformanceReporting.enabled = false;
        }
        catch (System.MissingMethodException)
        {

        }
    }

Any Idea another idea? This is very frustrating, I very near to the release, please help me :slight_smile:

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.

This is a detail of the call:

Request

{
    "common": {
        "appid": "f5251b40-772d-4a48-9c6c-e12e1434a163",
        "userid": "daade7c9f328d8fa0bac7f96775456e8",
        "sessionid": 6574538844233842516,
        "platform": "AndroidPlayer",
        "platformid": 11,
        "sdk_ver": "u2021.3.4f1",
        "sdk_rev": "cb45f9cae8b7",
        "session_count": 37,
        "localprojectid": "e8fd29c28cd22564e8118fb6ee7cb034",
        "build_guid": "c90ec41e18510f140af5ed1e47150d2b",
        "deviceid": "unknown",
        "identity_token": "daade7c9f328d8fa0bac7f96775456e8",
        "t_since_start": 4136380
    }
}

Response:

{
    "prefs": {},
    "analytics": {
        "enabled": true
    },
    "connect": {
        "limit_user_tracking": false,
        "player_opted_out": false,
        "enabled": true
    },
    "performance": {
        "enabled": true
    },
    "dynamic": {
        "coreBusinessMetrics": {
            "enabled": true,
            "timeToWaitForUserInfoS": 60
        },
        "analytics": {
            "shouldCollectAutomation": true,
            "timeToWaitForUserInfoS": 60
        }
    }
}

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?

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?

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
8453189--1121558--upload_2022-9-20_18-15-54.png

8453189--1121564--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.

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.

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

And a call before the disabling code was made.

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

Please help me out

8453246--1121579--upload_2022-9-20_18-38-4.png

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.

1 Like

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.

1 Like