I’m using Unity 2020.3.28f1 and Analytics 3.0.0-pre.3.
I thought my Analytics configuration and workflow was ok since everything was working fine in the editor (default events, custom event), however when building and testing on Android, no events are sent.
Serializing is fine, it’s just the sending that fails, as I could see after having activated logging via UNITY_ANALYTICS_EVENT_LOGS : Events failed to upload (code 400) – will retry at next heartbeat. It fails both on default and custom events.
Can I get some additional debugging information concerning this error? I’ve tried to check/uncheck Development Build but it has no effect, either on the problem or on the logging.
I’ve tried to build for Windows and everything works as it should. Maybe there is some obvious Android configuration pitfall I have missed?
I’ll look into getting some more information, but 400 (bad request) suggests something is going wrong with the serialization and perhaps we’re not sending valid info to the platform.
The desire response is a 204 - is it possible for you to intercept the content being sent up to the analytics platform?
We’ve noticed that some users with different localisations are recording floating point parameters with commans instead of full stops to mark where the decimal begins, that’s something we’re working towards correcting in subsequent package releases.
Happy to go dig up some instructions for you if getting that request payload isn’t something you’re familiar with.
Thanks for your answer. The localisation is FR_fr so that may be related, although my Windows OS is in FR_fr too and since it works in the editor and in the Windows build, that sounds unlikely. I haven’t seen floats in the default events and I don’t have any in my custom event anyway.
Please, that would help. I’ve tried to install Charles and use it as a proxy but I couldn’t get it to work.
Thanks for posting a more detailed example, which solved the problem.
Events.ProvideOptInConsent() is mandatory in EU where the GPRD is required, unfortunately it is not in the code of the official documentation and since there is not dedicated error message, it’s pretty much impossible to find out what is wrong and how to fix it.
I am dealing with the same problem that @ -Joly described. I’m also using Unity 2020.3.28f and Analytics 3.0.0-pre.3. Here is my code for initializing Unity Analytics beta:
Initialize() is called on Start() from my GameManager. I can see Events being recorded and uploaded successfully if I run the app in Unity Editor and on my iPad. Even the environment detection seems to be working fine. If I run the app on an Android device however, I can see Events being recorded, but as soon as they are uploaded it says Events failed to upload (code 400) – will retry at next heartbeat. I am not recording any custom events only the defaults events are recorded.
@christopher_hof We think we may know the cause of the issue. Where are you located? Some locales (like Spain) use a comma as the decimal separator which confuses our JSON parser. We are working on a fix for this, if so.
It may be a bit of a pain to get Charles Proxy working, you would likely need to directly edit the manifest in the project to obtain an unencrypted capture. There is a charlesproxy.unitypackage that is meant to do this, but it may be outdated.
I can confirm, after setting my device language to English one again and also setting the date format to 24-four format (not sure if thats really necessary), the events were uploaded successfully and are listed in the Event Browser.
That’s great to hear. The underlying issue is fixed in the next version of the Analytics package, due out very soon - after which issues with certain locales experiencing 400 upload errors should be fixed.