'How to make custom firebase events in Unity android project?
Firebase provides some default events like level_up. Here is how you can call this event in code:
FirebaseAnalytics.LogEvent(FirebaseAnalytics.EventLevelUp, new Parameter(FirebaseAnalytics.ParameterLevel, levelNumber));
I`ve tried making my own events like this (the way firebase quickstart project does it):
FirebaseAnalytics.LogEvent("Player pressed the button", "Button name", someIntvalue));
Basically sending parameters as strings.
I`ve also tried writing this function like that:
FirebaseAnalytics.LogEvent("Player pressed the button", new Parameter("Button name", someIntValue));
None of these two variants get registered in debug view of firebase analytics, but the default events do.
What is the problem?
Thanks in advance!
Solution 1:[1]
You should replace the spaces in the event names with underscores. I believe that you're not following the rules for event names:
Event names can be up to 40 characters long, may only contain alphanumeric characters and underscores ("_"), and must start with an alphabetic character. The "firebase_", "google_", and "ga_" prefixes are reserved and should not be used.
https://firebase.google.com/docs/reference/cpp/group/event-names
Solution 2:[2]
Try this way
FirebaseAnalytics.LogEvent("get_gems_click : ", "get_gems_click", 1);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Patrick Martin |
| Solution 2 | Sanjay Hadiya |
