I'm using last version of Firebase with Analytics to track screen openings on an app. I'm checking on Firebase that the screen openings are being tracked but they only are showing the activity Java class name under the "Screen class" table. If I switch to "Screen name" then (not set) is displayed. No screen names are being tracked.
I tried two ways I find on the official documentation and here in Stack Overflow:
Way 1:
mFirebaseAnalytics.setCurrentScreen(SectionManager.getInstance().getCurrentActivity(), name, null /* class override */);
Way 2:
Bundle params = new Bundle();
params.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "screen");
params.putString(FirebaseAnalytics.Param.ITEM_NAME, name);
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.VIEW_ITEM, params);
I double checked that name
variable contains the real name of the screen.
None of them work. I can't seem to solve it checking on other questions here and also checking the official documentation.
it seems like you forget to initialize mFirebaseAnalytics
you need to initialize it on onCreate method first and make sure that you call mFirebaseAnalytics.logEvent(..)
after this initialization check out how to initialize on each screen
// [START declare_analytics]
private FirebaseAnalytics mFirebaseAnalytics;
// [END declare_analytics]
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// here the initialization of instance
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
}
tell me if this answer is working for you or not, or you can also update code snipit in your question that i can do proper analysis on this issue, thanks
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.