Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Custom events too large b/c of "unity_monetization_extras" parameters

Discussion in 'Unity Analytics' started by andras_starberry, Jan 4, 2019.

  1. andras_starberry

    andras_starberry

    Joined:
    Nov 1, 2018
    Posts:
    5
    Hello there. Sending custom events from code, we noticed that sometimes there is an additional key-value pair attached to the dictionary we're attaching as parameters. This additional pair is a dictionary from a string ("unity_monetization_extras") to a dictionary<string, object>, which contains "gamer_token" and "game_id". The token being a ginormous string, the call then fails with SizeLimitReached. This was seen on Android mobile devices.

    E.g. what we're sending:

    Code (CSharp):
    1.   AnalyticsEvent.Custom("Foo", new Dictionary<string, object>
    2.     {
    3.         { "bar", "someValue" }
    4.     });

    but, when debugging on device, it seems that what we _actually_ try to send is:

    Code (CSharp):
    1.   "bar" => "someValue",
    2.   "unity_monetization_extras" => "{"gamer_token": "super long string"}","game_id":"<our game id>"}
    This is on Unity 2018.3.0f2. Any ideas what we might be doing wrong?
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,356
  3. andras_starberry

    andras_starberry

    Joined:
    Nov 1, 2018
    Posts:
    5
    Yes, we are using monetization. I think the problem is that Unity doesn't even try to send the calls, because they are judged to be too big. But in any case I'll try to investigate further with Charles. Meanwhile, any tips on who to turn to with this?
     
  4. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,356
    Turn to this, you mean for assistance with Charles? If you have specific questions, please ask here, this is the correct support resource. When you say "debugging on device", can you clarify? Do you have the device logs?
     
  5. andras_starberry

    andras_starberry

    Joined:
    Nov 1, 2018
    Posts:
    5
    Sorry for being ambiguous. By "this", I referred to the whole problem, not Charles- I just meant that I wasn't sure how useful Charles would be in the case where the problem seems to be that Unity is not trying to send calls, because the payload is judged to be too big. And by debugging on device, I meant, yes, we see in Android device logs, that sometimes the "unity_monetization_extras" key-value pair is attached to the parameters we're trying to send. (I.e.: we prepare the parameters, pass them on to AnalyticsEvent.Custom() but keep the reference to the parameters sent, then log the parameters using Debug.Log, and now we see they contain an extra key-value pair). In these cases the result of the AnalyticsEvent.Custom() call is AnalyticsResult.SizeLimitReached. Unfortunately though I couldn't find a way to reliably reproduce this behaviour.
     
  6. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,356
    A Charles log would be very useful to our troubleshooting, and would show the exact contents of the network requests. And it would be useful information to know if the request was not sent in the first place, a Charles log cross referenced to the date-time from the device log and possible Debug.Log statement at the same time would be useful. It would assume of course that you can reproduce the behavior during the test, which agreed would be problematic.
     
  7. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,356
    Upon further investigation, as a workaround you should be able to use `Analytics.Custom` instead of `AnalyticsEvent.Custom`. It would also be good to know what versions you are using, specifically the Analytics package and the version of Unity.