Manny265
Manny265

Reputation: 1709

Firebase Analytics not showing up in console

I have an android app which has a singleton class within which I want to use a FirebaseAnalytics object to collect data.
In the onCreate object of the singleton class, I initialise the object by doing the following:

    analytics = FirebaseAnalytics.getInstance(getApplicationContext());//get firebase analytics instance
    analytics.setAnalyticsCollectionEnabled(true);//enable analytics
    analytics.setMinimumSessionDuration(60000);//minimum session is 1 minute
    analytics.setUserId(pref.getUserId());//set user ID

I have a method in the singleton class that receives two variables namely category and name. I have called this method from another activity and tried to set the category and name but it doesnt show up in my Firebase console, only the default collectables are showing:

    Bundle params = new Bundle();
    params.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, category);
    params.putString(FirebaseAnalytics.Param.ITEM_NAME, name);
    //log event
    analytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, params);

What am I doing wrong here? How can I make the data collected show in my analytics console?

Upvotes: 3

Views: 2474

Answers (1)

Steve Ganem
Steve Ganem

Reputation: 10851

If you look at the documentation for the SELECT_CONTENT event, you'll see that you're supposed to pass the parameters CONTENT_TYPE and ITEM_ID.

Upvotes: 4

Related Questions