Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Question Definition of Custom Events on Event Manager

Discussion in 'Unity Analytics' started by mariabrito17, Sep 13, 2022.

  1. mariabrito17

    mariabrito17

    Joined:
    Feb 23, 2021
    Posts:
    10
    Hello!

    We are working on implementing the analytics side of our game and there are some questions I can't find the answer anywhere:

    1. To receive the custom events on Unity and see them appear on Event Browser, we need to define them in Event Manager. Do we need to define only the event name or do we also need to define all the parameters?
    2. Previously we worked with Firebase and there all custom events already came with automatic fields such as the user_id, level, app version, event_timestamp. Is this a thing on Unity as well? Or do we need to add them manually on the developer side?
    Thank you!
     
  2. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    283
    Hi there,
    Thanks for posting on the forums!

    1) To receive custom events on Unity you must do accomplish the following:
    It is suggested that your events hold parameters needed.
    Example: MissionCompleted Event Will included the parameters listed above but additionally you can assign other parameters. Example : missionName, missionLevel,missionDifficulty

    2) Custom events come with the following by default, No need to add them additionally
    • eventTimeStamp
    • userID
    • sessionID
    • eventName
    • eventUUID
    • eventParams
      • clientVersion
      • platform
      • userCountry
    If you need help feel free to either start a new thread or post here.
    Hope this helps out.

    Best,
    Seb
     
  3. mariabrito17

    mariabrito17

    Joined:
    Feb 23, 2021
    Posts:
    10
    Thank you so much for the swift and insightful answer.

    I have just one more question about the parameters of custom events. I read that these events have a limit of 10 parameters. Does this limit include the default parameters or it's a limit for custom parameters only? That is, can I have a custom event with the default parameters + 10 custom parameters?
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    The 10 parameter limit only applied to legacy Analytics, not UGS Analytics
     
  5. EcceHomo

    EcceHomo

    Joined:
    Mar 2, 2015
    Posts:
    2
    Hi SebT_Unity is there a ongoing problem with Custom Events when reporting eventParams inside Event Browser?

    My custom levelComplete event.
    upload_2022-12-19_14-27-30.png

    With 8 custom eventParams
    upload_2022-12-19_14-27-17.png

    Code for sending levelComplete with 8 eventParams
    Code (CSharp):
    1.         Dictionary<string, object> usaData = new Dictionary<string, object>();
    2.  
    3.         // General telemetry data
    4.         data.Add("levelName", levelName);
    5.         data.Add("collectedCoins", collectedCoins);
    6.         data.Add("totalCoins", totalCoins);
    7.         data.Add("remainingLife", remainingLife);
    8.  
    9.         // Booster telemetry data
    10.         data.Add("boosterLollipop", boosterLollipopCount);
    11.         data.Add("boosterBomb", boosterBombCount);
    12.         data.Add("boosterSwitch", boosterSwitchCount);
    13.         data.Add("boosterColorBomb", boosterColorBombCount);
    14.  
    15.         // Unity service analytics custom levelComplete implementation
    16.         AnalyticsService.Instance.CustomData("levelComplete", usaData);
    I can see Event content inside Event Browser, but I don't see my 8 eventParams
    upload_2022-12-19_14-26-56.png
     
  6. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    283
    Hi EcceHomo,

    Thanks for contacting us on the forums. Here is a sample script to handle custom events

    Code (CSharp):
    1.  private void HandleCustomEvent()
    2.     {
    3.         //Handle Custom event
    4.         Dictionary<string, object> parameters = new Dictionary<string, object>()
    5.         {
    6.             { "levelName", levelName},
    7.             { "collectedCoins", collectedCoins}
    8.         };
    9.  
    10.         AnalyticsService.Instance.CustomData("levelComplete", parameters);
    11.      
    12.         // You can call Events.Flush() to send the event immediately
    13.         AnalyticsService.Instance.Flush();
    14.  
    15.     }
    While looking at your source I can see that your dictionary name is
    usaData
    but when adding to your declared dictionary you used the variable name
    data

    calling usaData.add("... should solve your issue with logging custom events.

    Let me know if this helps you out and have additional questions.
    Seb
     
    Last edited: Dec 19, 2022
  7. EcceHomo

    EcceHomo

    Joined:
    Mar 2, 2015
    Posts:
    2
    Hi SebT_Unity thank you so much for your feedback, yes dictionary name was the problem

    I can see Event content inside Event Browser, and my 8 eventParams
    upload_2022-12-19_22-20-43.png
     

    Attached Files:

    SebT_Unity likes this.