59

I've seen some questions and answers about custom events for firebase analytics, but i just wanted to ask you a straight question so you can give me a straight answer :)

So, this is my method for logging:

@Override
public void logFeatureSelectedEvent(String categoryName, String actionName, String labelName) {
    Bundle bundle = new Bundle();
    bundle.putString(EventTrackingKeys.EventTypes.CATEGORY, categoryName);
    bundle.putString(EventTrackingKeys.EventTypes.ACTION, actionName);
    bundle.putString(EventTrackingKeys.EventTypes.LABEL, labelName);
    mFirebaseAnalytics.logEvent(EventTrackingKeys.EventAnalyticTypes.FEATURE_SELECTED_EVENT, bundle);
}

with custom event/key names:

String CATEGORY = "category";
String ACTION = "action";
String LABEL = "label";
String FEATURE_SELECTED_EVENT = "feature_selected_event";

So, in my firebase console I only get event name "feature_selected_event", without custom parameter names.. I've seen some answers that i should call setUserProperty() method and register that user property in the User Properties tab of Firebase Analytics. Is this the right way to implement that method? :

   @Override
public void logFeatureSelectedEvent(String categoryName, String actionName, long value) {
    Bundle bundle = new Bundle();
    bundle.putString(EventTrackingKeys.EventTypes.CATEGORY, categoryName);
    bundle.putString(EventTrackingKeys.EventTypes.ACTION, actionName);
    bundle.putLong(EventTrackingKeys.EventTypes.VALUE, value);
    mFirebaseAnalytics.setUserProperty(EventTrackingKeys.EventTypes.CATEGORY, categoryName);
    mFirebaseAnalytics.setUserProperty(EventTrackingKeys.EventTypes.ACTION, actionName);
    mFirebaseAnalytics.setUserProperty(EventTrackingKeys.EventTypes.VALUE, value);
    mFirebaseAnalytics.logEvent(EventTrackingKeys.EventAnalyticTypes.FEATURE_SELECTED_EVENT, bundle);
}
joe
  • 1,341
  • 4
  • 21
  • 32

7 Answers7

41

You can see it in console without any hacks, but it is pretty hidden there.

Go to Firebase Analytics -> Stream View -> Select Events -> Top events -> select_content -> there you go

My code:

Bundle params = new Bundle();
params.putString("invalid_url", urlPart);
mFirebaseAnalytics.logEvent("eventInvalidUrl", params);

Firebase Analytics Stream View

Kuldeep
  • 2,589
  • 1
  • 18
  • 28
Josef Vancura
  • 1,053
  • 10
  • 18
  • 19
    This is only from the last 30 mins, so there's no other way to capture or visualize events data with specific bundle details? This service appears to be utterly useless. – Daniel Wilson Jul 03 '19 at 11:14
  • use analytics.google to see events logged from firebase. – Ahmad Shahwaiz Aug 25 '21 at 10:48
  • I used the same method of logging events. I see very few real events while most of these are 'not set' type. This is as per analytics report of 700+ users in 2 days. Anybody knows why? – Tushar Mate Jan 16 '22 at 13:13
27

The custom parameters will not be shown. Only suggested events with suggested parameters are presented in dashboard.

To see the custom parameters, you have to link your project to Big Query (it's not free).

Also Firebase will not show information if the number of user is less than 10.

TOP
  • 2,574
  • 5
  • 35
  • 60
  • even though I had more than 10 users, Firebase did not show custom parameters' values, but it appeared when I had more event calls. – BekaBot Jul 10 '18 at 05:29
23

If you are still looking for answer, You need to add custom parameters into the event manually once in the dashboard Like this https://support.google.com/firebase/answer/7397304?hl=en&ref_topic=6317489 Actually there is no need to link BigQuery for this. But it will take several hours to show up custom parameter once you navigate inside the event.

Muhammad Riyaz
  • 2,832
  • 2
  • 26
  • 30
11

In Firebase, As i know we have to log the events in < Key,value > pair and then need to log.

Like this :

bundle.putString("yourKey","yourValue");

For Example, I have put the Custom event in MyApp to get the AppOpen time as below.

    Bundle params = new Bundle();
    params.putString("open_time", TimeStampUtil.getTimeStamp(System.currentTimeMillis()));
    mFirebaseAnalytics.logEvent("app_open_time", params);

so, in above example i have create a custom event with name app_open_time and put the value with key as open_time.

Try in this way and for more info refer this : https://firebase.google.com/docs/analytics/android/events

Uttam Panchasara
  • 5,735
  • 5
  • 25
  • 41
  • 4
    Yep, but did you get that "open time" property in your firebase console? From my example, I "have feature_selected_event" and count that says how many time that event occurred, which is shown in console, but i can't see what are the values for "category", "action" and "label". I was searching for an answer and saw that i should add setUserProperty() method and register those properties in console.. but i'm not really sure how to use that method... – joe Nov 08 '16 at 09:53
  • No actually its not displayed in my app console too. may be its because its custom event. – Uttam Panchasara Nov 08 '16 at 10:05
  • @joe see my answer – TOP Nov 08 '16 at 11:04
  • Are you sure? That's also what i read somewhere, but what's the point of using setUserProperty() method and registering user properties in firebase console then? – joe Nov 08 '16 at 12:27
  • 1
    Will "app_open_time" be shown as the event name on the firebase console page like the other predefined event names like "app_remove" etc. What should be done if i want to show the custom event names on the console page? – UserName_Untold Jan 04 '17 at 06:52
  • Yes @Rachana "app_open_time" shown as event name same as other default events. and as per Firebase Doc the values of the log event displays only if you have paid account, with the Free account user will only able to see the events times, count and user counts. – Uttam Panchasara Jan 04 '17 at 06:56
  • But i have implemented the analytics for ios also and there the full names of events are shown. Meaning with whatever events we have logged the events the same are reflected on console page. why is that android does not have this? any idea – UserName_Untold Jan 04 '17 at 07:10
  • I really don't have any idea about iOS firebase analytic but as i also have implemented analytic in android apps and custom events it only shows me event names. – Uttam Panchasara Jan 04 '17 at 07:30
  • For accessing all the data(in your case the values part) that you log in Firebase Analytics.. you have to link firebase to use Google Big Query service that's not available for Free. http://stackoverflow.com/questions/38695326/firebase-analytics-events-dont-show-values – Uttam Panchasara Jan 04 '17 at 07:36
  • TimeStampUtil.getTimeStamp(System.currentTimeMillis()) could that be replaced with Server TimeStamp ? – MeLean Apr 29 '18 at 21:37
  • Yes you can add any timestamp – Uttam Panchasara May 01 '18 at 06:15
7

Not only do you need to do what Muhammad Riyaz says, you also need to get your user count up above the "threshold". In my case, installing my app on a dozen simulator versions pushed my user count to 12, and voila, suddenly I have custom event parameter data in my Firebase dashboard.

saswanb
  • 1,975
  • 1
  • 17
  • 25
3

Similar to @Josef Vancura answer, but in Kotlin:

val params = Bundle()
params.putString("invalid_url", urlPart)
mFirebaseAnalytics.logEvent("eventInvalidUrl", params)
Jerry Chong
  • 7,954
  • 4
  • 45
  • 40
1

Fire a custom event:-

Bundle bundle = new Bundle();
bundle.putString(variableName1, variableValue1);
bundle.putString(variableName2, variableValue2);
FirebaseAnalytics.getInstance(context).logEvent(event_name, bundle);

To view your custom events, open Firebase Console and go to Realtime Analytics and then scroll to bottom and check "Event count by Event name" section, you will find your event there.

hemdroid
  • 61
  • 1
  • 7