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