Implement Firebase Analytics in Flutter Web

Viewed 710

Trying to find some reliable documentation/instructions for for doing this. It seems like it's anybody's guess in terms of what should be added to the index.html file in the web directory. The snipped Firebase Console gives you when configuring the app still results in this issue, which has been closed for some reason, even though there's no solution in the thread. For context, all I'm doing is importing the firebase_analytics dependency and copy/pasting the CDN snipped provided in the firebase console within the <body> section of index.html. I tried placing it at the beginning, at the end, it still results in the black screen and this error in console:

TypeError: Cannot read properties of undefined (reading 'analytics') at Object.analytics$ [as analytics] (http://localhost:62421/packages/firebase/src/top_level.dart.lib.js:110:102) at new firebase_analytics_web.FirebaseAnalyticsWeb.new (http://localhost:62421/packages/firebase_analytics_web/firebase_analytics_web.dart.lib.js:63:64)

Can't find anything in the official documentation that would indicate how to solve this.

Any help would be valued. Also, if the implementation isn't ready or it's not working for any reason, would really appreciate the Flutter or Firebase team specifying that so that I don't spend hours on end fidgeting with different versions of sdk's and other settings in hopes of blindly stumbling upon a working configuration.

1 Answers
Related