-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 [firebase_analytics] WEB: User properties and custom events not working since Flutter 3 versions #8757
Comments
I think this issue is not related to Flutter 3 but to firebase_analytics. We are seeing the same described behaviour with the following configuration for Flutter Web:
When we set a user property we are facing the error Without setting user properties (skip step 3 above) the analytics events are sent successfully. -- Update: |
@kolotum Yes, I was referring to the Firebase versions that came with Flutter 3. The problem is that once you upgrade and apply changes for Flutter 3, you can't downgrade to 8.x.x versions because you get Firebase initialization errors. I think firebase_core is trying to use firebasejs version 9 (module) and it's not properly loading analytics if you use a downgraded version. |
Thanks for the report. Using steps to replicate provided above and running on web, I observed the same result as reported. Maybe related to : #8403 |
Upgraded to latest versions and still happening. firebase_core: ^1.17.1 |
EDIT1: I've just tested again, and userId user property is set, but custom user properties aren't. EDIT2: Tested in release mode and I get the same as when deployed in Firebase Hosting -> "Event parsing aborted: Cannot convert object to primitive value" after set user property + send custom event I've just tested that PR example app in localhost and the issue is still there. Events are successfully logged but user properties aren't. With GA Debug Extension ON, I can see the following messages: Set user propertyClick To Expand
Log eventClick To Expand
|
Hey @jronceroscb, I'm confused
Hey @jronceroscb, I'm trying to interpret what the issue is here. In debug mode, I don't see any error in the console, and the debug logs appear to show the custom event and user properties are correctly interpreted. Does this debug log not mean user property is set?
|
Hello @russellwheatley, thanks for the response. My guess is that the user property is set locally but is not propagated to Firebase servers. From my understanding, user properties are not sent until an event is logged. So, setting a user property locally seems to be working, but when logging an event, the event has no user properties in the request. |
By the way, I've been testing the Javascript SDK (9.8.2 version) to discard a possible issue in JS, and the user properties are correctly set when logging an event. As you can see in the next log, there is a 'up" parameter with the user property -> up.my_property: codelab Log event JAVASCRIPT SDKClick To Expand
|
@russellwheatley I think I've found what might be the issue. I think that the user properties in Flutter are being set as Objects and not as Strings. If you compare the Analytics Debug messages between Flutter and Javascript SDK you can see the difference: Flutter
Javascript SDK
Can you see the difference between analytics_example and "codelab"? One is an object and the other is a string. |
@russellwheatley that was it!! I've managed to make it work, I'll make a pull request to your v9/analytics branch. |
Awesome work, @jronceroscb! We gratefully accept PRs 😄 |
I have the same issue with Firebase user properties. But when debugging using debugView with GA debugger, I can't see it. This PR #8852 has merged already and the changes are available in master branch https://github.com/firebase/flutterfire/blob/master/packages/firebase_analytics/firebase_analytics_web/lib/interop/analytics.dart Is this issue resolved already for user properties with the latest version https://pub.dev/packages/firebase_analytics_web (0.4.1)? |
Hey @deepak786, this has been released with the web v9 JS SDK release: https://github.com/firebase/flutterfire/blob/master/packages/firebase_analytics/firebase_analytics/CHANGELOG.md#920. Use the latest version and it should be fine now. |
I have to wait until this issue is not resolved #9132 |
Bug report
I was able to successfully use Firebase Analytics in Flutter Web in my previous scenario:
I had some user properties that were sent along with our custom events. Everything was working fine.
But, since Flutter 3, this is not working anymore. My current setup is:
In this scenario, I'm facing two strange behaviours:
Event parsing aborted: Cannot convert object to primitive value. Event processing aborted.
Steps to reproduce
Steps to reproduce the behaviour:
Expected behavior
User properties and custom events are properly sent with Flutter 3 in WEB environment in localhost and hosting.
Sample project
You can just use the firebase_analytics example project and set your config in the firebase_config.dart file:
Firebase Analytics Example
Flutter doctor
Run
flutter doctor
and paste the output below:Click To Expand
Flutter dependencies
Run
flutter pub deps -- --style=compact
and paste the output below:Click To Expand
The text was updated successfully, but these errors were encountered: