Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Custom Event int accidentally string

Discussion in 'Unity Analytics' started by Hello-There-Dev, Apr 29, 2015.

  1. Hello-There-Dev

    Hello-There-Dev

    Joined:
    Jul 5, 2012
    Posts:
    20
    Hi,

    We just started testing and we have a problem with a parameter not getting tracked(?)

    This is probably caused by the parameter accidentally being submitted as a string the first day of testing (it's marked with an A instead of # like the other int parameters)

    What is the recommended way of solving this?
     
  2. marc_tanenbaum

    marc_tanenbaum

    Unity Technologies

    Joined:
    Oct 22, 2014
    Posts:
    637
    Hello there, Hello There,

    Parameters are tracked by inferred type, which means that 20 and "20" are considered to be the same thing. If you want a variable to be a string, force it to be interpreted as a string by adding non-numeric characters to it, e.g., "level20".

    If you make a mistake by sending the wrong type, you can just fix your code and change how you send. The system is smart enough to include one group of results by string and a separate group (under the same name) by number. As time goes on, the incorrect ones will simply fall off the back of your timeline. (You'll see BOTH '#' and 'A' during that transition).

    Looking at your data, I'm inclined to think that your latest events are simply waiting the usual few hours to process. You should see the missing parameter show up in data explorer shortly.
     
  3. Hello-There-Dev

    Hello-There-Dev

    Joined:
    Jul 5, 2012
    Posts:
    20
    Thanks for the quick reply!

    It's wierd though, since we've been sending this dictionary since the 24th

    Code (CSharp):
    1. Dictionary<string, object> dictionary = new Dictionary<string, object>(10);
    2.     dictionary.Add("score", userData.score);//int
    3.     dictionary.Add("longestChain", longestChain);//int
    4.     dictionary.Add("chains", userData.chains.Length);//int
    5.     dictionary.Add("gamesPlayed", HelloUnityAnalytics.ApproximateGamesPlayed(userData.gamesPlayed));//string
    6. UnityAnalytics.CustomEvent("Game Session End", dictionary);
    When we check integration - custom events - test custom event, we get events like this:

    04/30/2015 09:03:02
    Event: Game Session End
    • Parameters
    • chains > 11
    • gamesPlayed > GAME_21_50
    • longestChain > 116
    • score > 234130
    Platform: WindowsEditor
    SDK Version: 1.9.0


    And when we check the Data Explorer we only see this: scoreMissing.png
    no score, but all other parameters have entries.

    If we instead check earlier (when we sent a const string as score by misstake) we can see this: wrongScore.png

    Any idea of what could be wrong?
     
  4. marc_tanenbaum

    marc_tanenbaum

    Unity Technologies

    Joined:
    Oct 22, 2014
    Posts:
    637
    OK...we've dug into this and it's clearly a bug on our end. Something is not working as I described it above. My sincerest apologies. A quick (and admittedly poor) workaround is to change the name of the parameter to something else.

    I'll discuss this with the team today and we'll see if we can come up with a fix for you and for the larger problem.
     
  5. Hello-There-Dev

    Hello-There-Dev

    Joined:
    Jul 5, 2012
    Posts:
    20
    No problem, we're just glad we could help find this :)
     
  6. ProfTroy

    ProfTroy

    Joined:
    Mar 18, 2013
    Posts:
    26
    This is still an issue as of June 25/2015.
    Any ETA on a fix?
    I am using the 4.x/5.0 Analytics package.

    I'm at the point where I'm debating deleting the project and starting a new one to compensate. That seems like a horrible work around.
     
  7. marc_tanenbaum

    marc_tanenbaum

    Unity Technologies

    Joined:
    Oct 22, 2014
    Posts:
    637
    Sorry, we dropped the ball on this item. We've been crazy busy with 5.1 & 5.2 stuff. I'll see what it would take to get a fix out for this.

    In the meantime, rather than creating a new project, I'd suggest you simply create an event with a different name and track that. Seems like a better (read, "a bit less horrible") workaround.
     
  8. ProfTroy

    ProfTroy

    Joined:
    Mar 18, 2013
    Posts:
    26
    True, deleting the whole analytics project was definitely not the most logical solution. I don't do my best thinking at 7:44am.
    Fortunately I did not actually do it because I figured you might want to peek into the project data to verify and troubleshoot.

    I have already changed the event name, but haven't pushed that build with the new metrics. Was curious to see if it irons itself out after 1-3 days given the segment categories, it seemed plausible that the old integer params eventually filter out because they're too old.
     
  9. marc_tanenbaum

    marc_tanenbaum

    Unity Technologies

    Joined:
    Oct 22, 2014
    Posts:
    637
    Hi @ProfTroy. One of our engineers has been looking into this. I'll get his feedback this morning and update you.