Anirudh Sharma
Anirudh Sharma

Reputation: 727

Custom Events is not showing up on firebase dashboard at all

I cant see any update on firebase analytics dashboard. Also any example could help

That's my setup.

Widget build(BuildContext context) {
     FirebaseAnalytics analytics=new FirebaseAnalytics();
     FirebaseAnalyticsObserver observer=new FirebaseAnalyticsObserver(analytics: analytics);
    return GraphQLProvider(
      client: client,
      child: CacheProvider(
        child: MaterialApp(
          debugShowCheckedModeBanner: false,
          title: 'Baseball',
          theme: themedata(),
          navigatorObservers: <NavigatorObserver>[observer],
          home: getWidgetByRouteName(hasRoute,analytics,observer),
          routes: <String, WidgetBuilder>{
            '/season': (BuildContext context) => Season(),
            '/signInGraphQL': (BuildContext context) => SignInGraphQL(),
            '/teamSelect': (BuildContext context) => Team(),
            '/teamDetails': (BuildContext context) => TeamDetails(),
            '/phone': (BuildContext context) => Phone(),
          },
        ),
      ),
    );
  }

  ///directs app to the last opened page before closing application
  static Widget getWidgetByRouteName(bool hasRoute,analytics,observer) {
    // Put all your routes here.
    if (hasRoute) {
      return SignInGraphQL();
    } else {
      return SplashPage(analytics:analytics,observer:observer);
    }
  }

Also is there any working example available that would be helpfull and here is onclick button event.

class Button extends StatelessWidget {

  final FirebaseAnalytics analytics;
  final FirebaseAnalyticsObserver observer;
  Button({this.analytics,this.observer});

  Future<void> _sendAnalyticsEvent() async {
    await analytics.logEvent(
      name: 'test_event',
      parameters: <String, dynamic>{
        'string': 'string',
        'int': 42,
        'long': 12345678910,
        'double': 42.0,
        'bool': true,
      },
    );

  }
  @override
  Widget build(BuildContext context) {
    return SizedBox(
      height: 70,

      width: double.infinity,
      // height: double.infinity,
      child: InkWell(
        onTap: () {
          _sendAnalyticsEvent();
          FirebaseAuth.instance.currentUser().then((user) {
            if (user != null) {
             user.getIdToken().then((token){
               print("Firebase IdToken: "+token);
               centralstate.idToken=token;
             });

Terminal is not showing up any error. But i can't see any updates on firebase dashboard. Any suggestions?? thanks

Upvotes: 3

Views: 3188

Answers (2)

E. Sun
E. Sun

Reputation: 1344

Analytics events are sent to Firebase every hour or so, try using debug view instead https://firebase.google.com/docs/analytics/debugview

Upvotes: 4

Anirudh Sharma
Anirudh Sharma

Reputation: 727

Ok, it's working. It takes about 24 hours for analytics message to show up in portal..

Upvotes: 1

Related Questions