Search Unity

How to work around parameter limit

Discussion in 'Unity Analytics' started by RogueCode, Aug 21, 2017.

  1. RogueCode

    RogueCode

    Joined:
    Apr 3, 2013
    Posts:
    230
    In my game the player can collect multiple perks to finish a level. When they finish the level successfully, I want to know what perks they had (to be able to work out what the most common few perks were).
    I think the normal way is this:
    Analytics.CustomEvent("gameOver", new Dictionary<string, object>
    {
    { "Perk1Name", true },
    { "Perk2Name", true },
    { "Perk3Name", true },
    ...etc...
    });
    However when they have more than 10 perks I'll need to exclude the rest, which horridly skews the values.

    Is there a clever way to structure the data I send to achieve this?
     
  2. Benvictus

    Benvictus

    Joined:
    Sep 12, 2013
    Posts:
    87
    @RogueCode

    You could create your own structure and send it as an integer, for example; [0 = does not have perk] [1 = has perk].

    00010010

    I know that the 4th number represents the "Double Gold Perk". This can be good when using raw data export as you could decipher the results, however, it is not very dashboard friendly.

    Alternatively, you could send perks 1 to 9 and the 10th parameter can be true when there are 10 or more perks.

    These are just some uninformed suggestions as I do not know your game and what information you wish to gather from this event. Is your game perk based, is it a big part of the game? Would someone who has 10 perks be considered an average or pro player?
     
    RogueCode likes this.
  3. RogueCode

    RogueCode

    Joined:
    Apr 3, 2013
    Posts:
    230
    Yeah, that could work (the 00010010), but having to have pro for raw data is a deal-breaker (I'm on Plus).
    I've started looking into Google Analytics and it seems much more complete (and free) so far. So might have to switch to that :-|
     
  4. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @RogueCode

    You could send the perks in multiple custom events, grouping them in ways that make the most sense to you.

    Code (CSharp):
    1. Analytics.CustomEvent("coinPerks", new Dictionary<string, object>
    2. {
    3. { "Perk1Name", true },
    4. { "Perk2Name", true },
    5. ...
    6. { "Perk9Name", true },
    7. });
    8.  
    9. Analytics.CustomEvent("expPerks", new Dictionary<string, object>
    10. {
    11. { "Perk11Name", true },
    12. { "Perk12Name", true },
    13. ...
    14. { "Perk19Name", true },
    15. });
     
  5. RogueCode

    RogueCode

    Joined:
    Apr 3, 2013
    Posts:
    230
    Thanks!
    I was thinking a bit more about this and I wonder if you can tell me if something like this would work:

    if (they completed the level)
    {
    Analytics.CustomEvent("Perk1Name");
    Analytics.CustomEvent("Perk2Name");
    Analytics.CustomEvent("Perk3Name");
    Analytics.CustomEvent("Perk4Name");
    Analytics.CustomEvent("Perk5Name");
    ...etc...
    }

    That would then show up in the DataExplorer as cumulative totals for each one, right?
     
  6. Benvictus

    Benvictus

    Joined:
    Sep 12, 2013
    Posts:
    87
    @RogueCode

    Yes, each event would be counted seperately. You will be able to see the number of times each event has been received. So you could make a graph that shows how many players had each perk when they completed a level.

    Also, please keep in mind that there is a limit to the number of custom events that can be set each hour. For example; If you have 30 perks, then you'll quickly hit that limit when sending 30 events at the end of every level.
     
    Last edited: Aug 22, 2017