Search code examples
firebasefluttergoogle-analyticsfirebase-analyticsgoogle-analytics-firebase

Firebase Analytics Events - currentScreen is always screen_view


On my way implementing firebase analytics into my flutter app, i cant get the proper events to trigger or i dont get how this should work. Lets take the following code:

firebaseAnalytics.setCurrentScreen(screenName: "Dashboard");

When i trigger this event, in the Firebase Analytics debug view i see this:

Firebase Analytics DebugView

The same when i trigger the screen changes automatically via:

navigatorObservers: [
        FirebaseAnalyticsObserver(analytics: appState.firebaseAnalytics),
      ],

So my question is: Why does Analytics prints out "screen_view" instead of "Dashboard" or any other name i have in my named routes ??

The screen name is in fact submitted to the inner workings of the API cause i debugged firebase_analytics.dart on that place:

Future<void> setCurrentScreen(
      {@required String screenName,
      String screenClassOverride = 'Flutter'}) async {
    if (screenName == null) {
      throw ArgumentError.notNull('screenName');
    }

    await _channel.invokeMethod<void>('setCurrentScreen', <String, String>{
      'screenName': screenName,
      'screenClassOverride': screenClassOverride,
    });
  }

Solution

  • Answering my own question and thus wasting the bounty is hard but thats the way it is. Here are my findings:

    The user provided screenName in the API gets submitted to the Firebase Analytics Dashboard but you need to drill down on the event "screen_view" to see the actual clicked screen Names you supplied. Unfortunately the user supplied Name wont be shown in the debugView of the Firebase Analytics console which got me on the wrong trail in the first place, thinking that its missing altogether, which is wrong.

    tl;dr: screenName is just a parameter of screen_view Event and its right inside the screen_view event which you can drill down on.