我在 Firebase 分析仪表板上看不到任何更新。 另外任何示例都可以提供帮助
这就是我的设置。
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);
}
}
还有任何有用的工作示例吗? 这是 onclick 按钮事件。
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;
});
终端未显示任何错误。 但我在 firebase 仪表板上看不到任何更新。 有什么建议么?? 谢谢
最佳答案
分析事件大约每小时发送到 Firebase,请尝试使用调试 View https://firebase.google.com/docs/analytics/debugview
关于firebase - 自定义事件根本没有显示在 firebase 仪表板上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56611834/