firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.71k stars 3.97k forks source link

firebase_analytics sends only string event parameters #7025

Closed saveKenny closed 3 years ago

saveKenny commented 3 years ago

I'm developing a Flutter application and I'm sending event analytics using firebase_analytics package. I'm sending custom params with my analytics as the following:

My code:

    final FirebaseAnalytics analytics = FirebaseAnalytics();

    void onGroupCreate(String groupId, double totalInvites, bool isStatus) {
          analytics.logEvent(
            name: "create_group",
            parameters: <String, dynamic>{
              'user_id': globals.user.userId,
              'group_id': groupId,
              'total_invites': totalInvites,
              'is_status': isStatus
            },
          );
        }

I have added GA Custom definitions, based on my params. But I can only see String analytics (double and bool params aren't shown).

What am I doing wrong? Why GA accepts only String params using firebase_analytics package?

markusaksli-nc commented 3 years ago

Hi @saveKenny Could you please provide your flutter doctor -v and flutter pub deps -- --style=compact? Thank you

saveKenny commented 3 years ago
[✓] Flutter (Channel stable, 2.2.3, on Linux, locale en_IL)
    • Flutter version 2.2.3 at /home/daniel/projects/frontend/flutter
    • Framework revision f4abaa0735 (3 months ago), 2021-07-01 12:46:11 -0700
    • Engine revision 241c87ad80
    • Dart version 2.13.4

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /home/daniel/Android/Sdk
    • Platform android-30, build-tools 30.0.2
    • ANDROID_HOME = /home/daniel/Android/Sdk
    • Java binary at: /home/daniel/projects/frontend/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

[✓] Android Studio (version 4.0)
    • Android Studio at /home/daniel/projects/frontend/android-studio
    • Flutter plugin version 50.0.1
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.59.1)
    • VS Code at /usr/share/code
    • Flutter extension version 3.26.0

[!] Connected device
    ! No devices available

! Doctor found issues in 2 categories.
Dart SDK 2.13.4
Flutter SDK 2.2.3
app_frontend 1.6.2+41

dependencies:
- age_calculator 1.0.0 [flutter]
- auto_size_text 2.1.0 [flutter]
- bot_toast 4.0.1 [flutter]
- bubble 1.2.1 [flutter]
- cached_network_image 3.1.0 [flutter flutter_cache_manager octo_image cached_network_image_platform_interface cached_network_image_web]
- cloud_firestore 2.4.0 [cloud_firestore_platform_interface cloud_firestore_web firebase_core firebase_core_platform_interface flutter meta]
- contacts_service 0.6.1 [flutter collection quiver]
- cupertino_icons 1.0.3
- device_info 2.0.2 [flutter device_info_platform_interface]
- dio 4.0.0 [http_parser path]
- firebase_analytics 8.2.0 [firebase_analytics_platform_interface firebase_analytics_web firebase_core flutter meta]
- firebase_auth 3.0.1 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta]
- firebase_core 1.4.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_crashlytics 2.1.1 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace]
- firebase_in_app_messaging 0.5.0+7 [firebase_core flutter meta]
- firebase_messaging 10.0.4 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta]
- firebase_performance 0.7.0+7 [firebase_core flutter]
- firebase_remote_config 0.10.0+3 [firebase_core firebase_core_platform_interface firebase_remote_config_platform_interface flutter]
- flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]
- flutter_autolink_text 1.0.0+1 [flutter]
- flutter_countdown_timer 4.1.0 [flutter]
- flutter_launcher_icons 0.9.1 [args image path yaml]
- flutter_linkify 5.0.2 [flutter linkify]
- flutter_native_splash 1.2.1 [args image meta path xml yaml universal_io]
- flutter_picker 2.0.2 [flutter]
- flutter_rating_bar 4.0.0 [flutter]
- font_awesome_flutter 9.1.0 [flutter]
- geocoding 2.0.0 [flutter geocoding_platform_interface]
- geoflutterfire 3.0.1 [flutter cloud_firestore rxdart]
- google_fonts 2.1.0 [flutter http path_provider crypto]
- http 0.13.3 [async http_parser meta path pedantic]
- image_cropper 1.4.1 [flutter]
- image_picker 0.8.3+2 [flutter flutter_plugin_android_lifecycle image_picker_for_web image_picker_platform_interface]
- intro_slider 3.0.2 [flutter]
- latlong 0.6.1 [logging console_log_handler validate intl]
- like_button 2.0.2 [flutter]
- package_info 2.0.2 [flutter]
- permission_handler 8.1.4+2 [flutter meta permission_handler_platform_interface]
- qr_flutter 4.0.0 [flutter qr]
- share 2.0.4 [meta mime flutter]
- shared_preferences 2.0.6 [meta flutter shared_preferences_platform_interface shared_preferences_linux shared_preferences_macos shared_preferences_web shared_preferences_windows]
- spring 2.0.2 [simple_animations supercharged universal_platform vector_math flutter]
- swipe_to 0.0.1+8 [flutter]
- timeago 3.1.0
- tutorial_coach_mark 0.6.0+1 [flutter]
- url_launcher 6.0.9 [flutter meta url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows]
- uuid 3.0.4 [crypto]
- visibility_detector 0.2.0 [flutter]

dev dependencies:
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span stream_channel string_scanner term_glyph typed_data]

transitive dependencies:
- ansicolor 1.1.1
- archive 3.1.2 [crypto path]
- args 2.2.0
- async 2.6.1 [meta collection]
- boolean_selector 2.1.0 [source_span string_scanner]
- cached_network_image_platform_interface 1.0.0 [flutter flutter_cache_manager]
- cached_network_image_web 1.0.1 [flutter flutter_cache_manager cached_network_image_platform_interface]
- characters 1.1.0
- charcode 1.2.0
- clock 1.1.0
- cloud_firestore_platform_interface 5.3.0 [collection firebase_core flutter meta plugin_platform_interface]
- cloud_firestore_web 2.3.0 [cloud_firestore_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js]
- collection 1.15.0
- console_log_handler 1.1.6 [logging intl ansicolor]
- cross_file 0.3.1+4 [flutter meta]
- crypto 3.0.1 [collection typed_data]
- device_info_platform_interface 2.0.1 [flutter meta plugin_platform_interface]
- fake_async 1.2.0 [clock collection]
- ffi 1.1.2
- file 6.1.2 [meta path]
- firebase 9.0.1 [http http_parser js]
- firebase_analytics_platform_interface 2.0.1 [flutter meta]
- firebase_analytics_web 0.3.0+1 [firebase firebase_analytics_platform_interface flutter flutter_web_plugins meta]
- firebase_auth_platform_interface 6.0.0 [firebase_core flutter meta plugin_platform_interface]
- firebase_auth_web 3.0.0 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser intl js meta]
- firebase_core_platform_interface 4.0.1 [collection flutter meta plugin_platform_interface]
- firebase_core_web 1.1.0 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- firebase_crashlytics_platform_interface 3.1.0 [collection firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_platform_interface 3.0.3 [firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_web 2.0.3 [firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta]
- firebase_remote_config_platform_interface 0.3.0+3 [firebase_core flutter meta plugin_platform_interface]
- flutter_blurhash 0.6.0 [flutter meta pedantic]
- flutter_cache_manager 3.1.2 [clock collection file flutter http path path_provider pedantic rxdart sqflite uuid]
- flutter_plugin_android_lifecycle 2.0.2 [flutter]
- flutter_web_plugins 0.0.0 [flutter js characters collection meta typed_data vector_math]
- geocoding_platform_interface 2.0.0 [flutter meta plugin_platform_interface]
- http_parser 4.0.0 [charcode collection source_span string_scanner typed_data]
- image 3.0.2 [archive meta xml]
- image_picker_for_web 2.1.2 [flutter flutter_web_plugins image_picker_platform_interface meta]
- image_picker_platform_interface 2.2.0 [flutter http meta plugin_platform_interface cross_file]
- intl 0.17.0 [clock path]
- js 0.6.3
- linkify 4.1.0
- logging 0.11.4
- matcher 0.12.10 [stack_trace]
- meta 1.3.0
- mime 1.0.0
- octo_image 1.0.0+1 [flutter flutter_blurhash]
- path 1.8.0
- path_provider 2.0.2 [flutter path_provider_platform_interface path_provider_macos path_provider_linux path_provider_windows]
- path_provider_linux 2.0.2 [flutter path path_provider_platform_interface xdg_directories]
- path_provider_macos 2.0.2 [flutter]
- path_provider_platform_interface 2.0.1 [flutter meta platform plugin_platform_interface]
- path_provider_windows 2.0.3 [ffi flutter meta path path_provider_platform_interface win32]
- pedantic 1.11.1
- permission_handler_platform_interface 3.6.1 [flutter meta plugin_platform_interface]
- petitparser 4.1.0 [meta]
- platform 3.0.0
- plugin_platform_interface 2.0.1 [meta]
- process 4.2.3 [file path platform]
- qr 2.1.0 [meta]
- quiver 3.0.1 [matcher]
- rxdart 0.27.1
- shared_preferences_linux 2.0.2 [file meta flutter path path_provider_linux shared_preferences_platform_interface]
- shared_preferences_macos 2.0.2 [flutter shared_preferences_platform_interface]
- shared_preferences_platform_interface 2.0.0 [flutter]
- shared_preferences_web 2.0.1 [flutter flutter_web_plugins meta shared_preferences_platform_interface]
- shared_preferences_windows 2.0.2 [flutter file meta path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface]
- simple_animations 3.1.1 [flutter supercharged pedantic]
- sky_engine 0.0.99
- source_span 1.8.1 [collection path term_glyph]
- sqflite 2.0.0+3 [flutter sqflite_common path]
- sqflite_common 2.0.0+2 [synchronized path meta]
- stack_trace 1.10.0 [path]
- stream_channel 2.1.0 [async]
- string_scanner 1.1.0 [charcode source_span]
- supercharged 2.0.0 [supercharged_dart flutter]
- supercharged_dart 2.0.0
- synchronized 3.0.0
- term_glyph 1.2.0
- test_api 0.3.0 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher]
- typed_data 1.3.0 [collection]
- universal_io 2.0.4 [collection crypto meta typed_data]
- universal_platform 1.0.0+1
- url_launcher_linux 2.0.1 [flutter]
- url_launcher_macos 2.0.1 [flutter]
- url_launcher_platform_interface 2.0.4 [flutter plugin_platform_interface]
- url_launcher_web 2.0.2 [flutter flutter_web_plugins meta url_launcher_platform_interface]
- url_launcher_windows 2.0.1 [flutter]
- validate 1.7.0
- vector_math 2.1.0
- win32 2.2.5 [ffi]
- xdg_directories 0.2.0 [meta path process]
- xml 5.1.2 [collection meta petitparser]
- yaml 3.1.0 [collection source_span string_scanner]
saveKenny commented 3 years ago

@markusaksli-nc According to Firebase support team: However, since your ??parameters with ?string ?data type as values are shown in the report, it is safe to assume that there's no issue in your implementation. To give some insights regarding custom dimensions and metrics, do note that custom dimensions refer to text-type parameters, while metrics refer to number-type parameters. So before logging these parameters, you have to register accordingly the ?string type parameters as custom dimensions and ?integer ?(double/long) type parameters as custom metrics in the Custom Definitions page for them to appear in the report. As for your boolean type parameters, you can register them as custom dimensions. It will depend on your use case and how you indicate your boolean values (e.g. "True" or "False", "Yes" or "No"). You can check this article to learn more.

It seems that the firebase_analytics package example is misleading since you are sending boolean parameter instead of string.

markusaksli-nc commented 3 years ago

So is the issue that your custom metrics are not working through the plugin or that the example is misleading by supplying a bool value with a boolean instead of a string?

saveKenny commented 3 years ago

Yes the example is misleading so I have opened a pull request. Thanks for the support

markusaksli-nc commented 3 years ago

Thanks, I'll label this to track it until the PR gets merged