Definition of Custom Events on Event Manager

Hello!

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

  • 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?
  • 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!

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

  1. 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

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?

The 10 parameter limit only applied to legacy Analytics, not UGS Analytics

Hi SebT_Unity is there a ongoing problem with Custom Events when reporting eventParams inside Event Browser?

My custom levelComplete event.

With 8 custom eventParams

Code for sending levelComplete with 8 eventParams

        Dictionary<string, object> usaData = new Dictionary<string, object>();

        // General telemetry data
        data.Add("levelName", levelName);
        data.Add("collectedCoins", collectedCoins);
        data.Add("totalCoins", totalCoins);
        data.Add("remainingLife", remainingLife);

        // Booster telemetry data
        data.Add("boosterLollipop", boosterLollipopCount);
        data.Add("boosterBomb", boosterBombCount);
        data.Add("boosterSwitch", boosterSwitchCount);
        data.Add("boosterColorBomb", boosterColorBombCount);

        // Unity service analytics custom levelComplete implementation
        AnalyticsService.Instance.CustomData("levelComplete", usaData);

I can see Event content inside Event Browser, but I don’t see my 8 eventParams

Hi EcceHomo,

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

 private void HandleCustomEvent()
    {
        //Handle Custom event
        Dictionary<string, object> parameters = new Dictionary<string, object>()
        {
            { "levelName", levelName},
            { "collectedCoins", collectedCoins}
        };

        AnalyticsService.Instance.CustomData("levelComplete", parameters);
      
        // You can call Events.Flush() to send the event immediately
        AnalyticsService.Instance.Flush();

    }

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

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

1 Like