3

I want to log custom events in the firebase analytics and I am using the standard way of doing it like below:

Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, eventCategory);
bundle.putString(FirebaseAnalytics.Param.ITEM_ID,eventType);
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, eventName);
FcmAnalytics.getInstance(context).logEvent(eventType, bundle);

Although I referred documentation and multiple questions and even the firebase analytics documentation I am finding it difficult to understand with the way things are working here. I think most of them would have this issue as there is no clear documentation for this topic

Firstly can someone explain to me the meanings of the ITEM_CATEGORY, ITEM_NAME, ITEM_ID while logging the event and how are these reflected on the console.

Suppose I want to log an custom event on click of a button with a custom event name say "button_click_event" and want to see the same event on the console to see how many users have clicked the button, how do i do it?

I have used some predefined EVENTS like SELECT_CONTENT and VIEW_ITEM so how do I know which button was selected or which page was viewed, as only the event category names like "select_content"/"view_item" are shown in the console. How do I do it? Please help?

Jaydip
  • 592
  • 5
  • 27
UserName_Untold
  • 165
  • 1
  • 13

1 Answers1

0

When logging an event, you can really use any param for any purpose, or make up your own params for your own use. You need to use params consistently so that they always mean the same thing in your app or you won't get useful information from them.

The ITEM_CATEGORY, ITEM_NAME, and ITEM_ID are described here. They are intended to be used with the VIEW_ITEM event.

To log a "button_click_event" from your app, you will need to create a FirebaseAnalytics instance within your activity, and call logEvent("button_click_event", new Bundle()) on it. Or you can add a param to the Bundle, such as the name of the button. Custom params won't show up in your reports but you can get a count of the number of times the event was logged in the dashboard.

You could try using the SELECT_CONTENT predefined event in place of a button_pressed_event, and a predefined param such as CONTENT_TYPE or ITEM_ID for the name of the button. Then I believe you would see the param information in the dashboard. You might need to wait 24 hours for the new data to show up.

Dan Morenus
  • 1,068
  • 8
  • 12