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 Custom Events Never Appearing in Event Browser

Discussion in 'Unity Analytics' started by aaronmichaelfrost, Oct 5, 2022.

  1. aaronmichaelfrost

    aaronmichaelfrost

    Joined:
    Feb 4, 2021
    Posts:
    39
    Hi there, my custom events don't appear in the Event browser, not even under Invalid Events, even after 24 hours, in Unity 2022.1.18f1.

    I first created a custom event using UGS Dashboard Event Manager. The event name is "friendInvited".

    To fire the event, I run this code:
    AnalyticsService.Instance.CustomData("friendInvited", new Dictionary<string, object>());

    AnalyticsService.Instance.Flush();


    I know the event is firing in Unity, because I defined UNITY_ANALYTICS_EVENT_LOGS, and I see the expected output.

    My account is definitely connected to cloud services under my only project. Crash reporting and cloud builds work just fine. Also, all the non-custom events appear just fine. Querying the event in the Data Explorer also provides no data.

    Help appreciated. Thanks!
     
  2. Julian-Unity3D

    Julian-Unity3D

    Unity Technologies

    Joined:
    Apr 28, 2022
    Posts:
    192
    Hey @aaronmichaelfrost

    I'm curious as to why you've tried it like this as it's not common practice to send empty custom data.
    AnalyticsService.Instance.CustomData("friendInvited", new Dictionary<string, object>());
    AnalyticsService.Instance.Flush();


    I can possibly understand that you would like to take a shortcut.

    To send a custom event you should be recording it like this:

    Code (CSharp):
    1. // Send custom event
    2. Dictionary<string, object> parameters = new Dictionary<string, object>()
    3. {
    4.     { "fabulousString", "hello there" },
    5. }
    6. AnalyticsService.Instance.CustomData("friendInvited", parameters);
    7.  
    8. // Optional - You can call Events.Flush() to send the event immediately
    9. AnalyticsService.Instance.Flush();
    You can see this in the documentation here: Record Custom Events (unity.com)


    However, while it should still work the way you done it, and upon testing it myself multiple times, can you confirm if you have initialized it correctly? Initial setup (unity.com)
     
  3. aaronmichaelfrost

    aaronmichaelfrost

    Joined:
    Feb 4, 2021
    Posts:
    39
    The solution was to follow the initial setup. That document was pretty hard to find from the inital documentation link on UGS cloud services. Maybe a good idea to put that somewhere more obvious.

    On another note, sending empty dict worked fine because there were no custom parameters specified in EventManager.
     
    Julian-Unity3D likes this.