firebase / firebase/firebase-android-sdk
SUGGESTION organize better analytics events
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 710
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 34
Description
## What feature would you like to see?
For the firebase analytics SDK i would like to see a different organization for the events params.
Lets say i want to log a default event type "user_login"
i would need to do something like
`FirebaseAnalytics.getInstance(context).logEvent(FirebaseAnalytics.Event.LOGIN, params);`
In order to discover what are the default params for this event I need to google for "analytics documentation" find the page with the real event documentation (since google will most likely point to hello worlds tutorials) at the complete event table look for the login event and read the params that should be provided as default.
All this because currently there is the main class `FirebaseAnalytics` and under it the class `Param` has constants for all default **events params fields**. So it is impossible know (looking to the class structure) which `Params` belongs to which `Event`
I DO KNOW there isnt problem at log an event without params or with a name different thant the default for that param. but would be so simple to organize the class structure to make it simple to look for the default expected params for an event
## What is suggest:
the class FirebaseAnalytics could have a subclass Events and below that each event type could have a child class with its name and constants for the expected default params
something like
```
public class FirebaseAnalytics {
public static final class Events{
public static final class Login{
public static final String NAME = "login";
public static final String PARAM_A = "a";
public static final String PARAM_B = "b";
//......
}
}
}
}
```
this way when i try to log a new event type i just need to look at the class structure to discover the params for that event.
another way would be at the current structure prepende the event name on each constant for the param class so the result would be something like
```
FirebaseAnalytics.Param.LOGIN_PARAM_A
FirebaseAnalytics.Param.LOGIN_PARAM_B
```
Contributor guide
Assessment
This issue has not been assessed yet.