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.72k stars 3.97k forks source link

πŸ› [firebase_analytics] Can't remove user id from tracking #8250

Closed apetroaeiandrei closed 2 years ago

apetroaeiandrei commented 2 years ago

Bug report

I want to clear user on logout. After I set user id to null, in the debug view of firebase analytics I still get the old user_id on events.

Steps to reproduce

Steps to reproduce the behavior:

  1. Call _firebaseAnalytics.setUserId(id: null);
  2. Track other app events
  3. Observe User Properties -> user_id on Firebase analytics console using Debug View

Expected behavior

Events logged after setting user id to null should not further track same user id.

Sample project

Providing a minimal example project which demonstrates the bug in isolation from your main App greatly enhances the chance of a timely fix. Please link to the public repository URL.


Additional context

Versions: firebase_core: ^1.13.1 firebase_analytics: ^9.1.2

Flutter plugin documentation.

[Setting a null [id] removes the user id(https://github.com/FirebaseExtended/flutterfire/blob/master/packages/firebase_analytics/firebase_analytics/lib/src/firebase_analytics.dart#L133)

Setting a null [value] removes the user property.

Found a similar issue that was closed: https://github.com/FirebaseExtended/flutterfire/issues/7442

Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand ``` Doctor summary (to see all details, run flutter doctor -v): [βœ“] Flutter (Channel stable, 2.10.2, on macOS 12.2.1 21D62 darwin-arm, locale en-RO) [βœ“] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1) [βœ“] Xcode - develop for iOS and macOS (Xcode 13.2.1) [βœ“] Chrome - develop for the web [βœ“] Android Studio (version 2021.1) [βœ“] VS Code (version 1.65.0) [βœ“] Connected device (3 available) [βœ“] HTTP Host Availability β€’ No issues found! ```

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand ``` Dart SDK 2.16.1 Flutter SDK 2.10.2 my_package_name 1.0.13+13 dependencies: - app_settings 4.1.1 [flutter] - collection 1.15.0 - conduit_password_hash 3.1.0 [crypto] - encrypt 5.0.1 [args asn1lib clock collection crypto pointycastle] - english_words 4.0.0 [string_scanner] - equatable 2.0.3 [collection meta] - firebase_analytics 9.1.2 [firebase_analytics_platform_interface firebase_analytics_web firebase_core firebase_core_platform_interface flutter] - firebase_core 1.13.1 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_crashlytics 2.5.3 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace] - flutter 0.0.0 [characters collection material_color_utilities meta typed_data vector_math sky_engine] - flutter_bloc 8.0.1 [flutter bloc provider] - flutter_html 2.2.1 [html csslib flutter_layout_grid video_player chewie webview_flutter chewie_audio flutter_svg flutter_math_fork collection numerus flutter] - flutter_inappwebview 5.3.2 [flutter] - flutter_keyboard_visibility 5.2.0 [meta flutter_keyboard_visibility_platform_interface flutter_keyboard_visibility_web flutter] - flutter_local_notifications 9.3.2 [clock flutter flutter_local_notifications_linux flutter_local_notifications_platform_interface timezone] - flutter_secure_storage 5.0.2 [meta flutter flutter_secure_storage_linux flutter_secure_storage_macos flutter_secure_storage_platform_interface flutter_secure_storage_web flutter_secure_storage_windows] - flutter_staggered_grid_view 0.6.1 [flutter] - flutter_stripe 2.2.0 [flutter stripe_android stripe_ios stripe_platform_interface] - flutter_stripe_web 0.1.1 [flutter flutter_web_plugins freezed_annotation stripe_platform_interface js] - gallery_saver 2.3.2 [flutter path_provider http path] - http 0.13.4 [async http_parser meta path] - image_picker 0.8.4+10 [flutter flutter_plugin_android_lifecycle image_picker_for_web image_picker_platform_interface] - intl_utils 2.6.1 [analyzer archive args dart_style http intl path petitparser yaml] - local_auth 1.1.11 [flutter flutter_plugin_android_lifecycle intl platform] - my_ui 1.0.0+1 [flutter flutter_html cupertino_icons] - path_provider 2.0.9 [flutter path_provider_android path_provider_ios path_provider_linux path_provider_macos path_provider_platform_interface path_provider_windows] - qr_code_scanner 0.7.0 [js flutter flutter_web_plugins] - qr_flutter 4.0.0 [flutter qr] - share_plus 3.1.0 [meta mime flutter share_plus_platform_interface share_plus_linux share_plus_macos share_plus_windows share_plus_web] - uni_links 0.5.1 [flutter uni_links_platform_interface uni_links_web] - universal_io 2.0.4 [collection crypto meta typed_data] - url_launcher 6.0.20 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows] dev dependencies: - flutter_lints 1.0.4 [lints] - flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher material_color_utilities meta source_span stream_channel string_scanner term_glyph typed_data] transitive dependencies: - _fe_analyzer_shared 36.0.0 [meta] - analyzer 3.3.1 [_fe_analyzer_shared collection convert crypto glob meta package_config path pub_semver source_span watcher yaml] - archive 3.2.1 [crypto path] - args 2.3.0 - asn1lib 1.1.0 - async 2.8.2 [collection meta] - bloc 8.0.2 [meta] - boolean_selector 2.1.0 [source_span string_scanner] - characters 1.2.0 - charcode 1.3.1 - chewie 1.3.0 [cupertino_icons flutter provider video_player wakelock very_good_analysis] - chewie_audio 1.3.0 [cupertino_icons flutter video_player] - clock 1.1.0 - convert 3.0.1 [typed_data] - cross_file 0.3.2 [flutter js meta] - crypto 3.0.1 [collection typed_data] - csslib 0.17.1 [source_span] - cupertino_icons 1.0.4 - dart_style 2.2.1 [analyzer args path pub_semver source_span] - dbus 0.7.1 [args ffi meta xml] - fake_async 1.2.0 [clock collection] - ffi 1.1.2 - file 6.1.2 [meta path] - firebase_analytics_platform_interface 3.1.1 [firebase_core flutter meta plugin_platform_interface] - firebase_analytics_web 0.4.0+8 [firebase_analytics_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js] - firebase_core_platform_interface 4.2.5 [collection flutter meta plugin_platform_interface] - firebase_core_web 1.6.1 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - firebase_crashlytics_platform_interface 3.2.1 [collection firebase_core flutter meta plugin_platform_interface] - flutter_keyboard_visibility_platform_interface 2.0.0 [flutter meta plugin_platform_interface] - flutter_keyboard_visibility_web 2.0.0 [flutter_keyboard_visibility_platform_interface flutter_web_plugins flutter] - flutter_layout_grid 1.0.3 [flutter collection meta quiver] - flutter_local_notifications_linux 0.4.2 [flutter flutter_local_notifications_platform_interface dbus path xdg_directories] - flutter_local_notifications_platform_interface 5.0.0 [flutter plugin_platform_interface] - flutter_math_fork 0.5.0 [flutter flutter_svg provider meta collection tuple] - flutter_plugin_android_lifecycle 2.0.5 [flutter] - flutter_secure_storage_linux 1.1.0 [flutter flutter_secure_storage_platform_interface] - flutter_secure_storage_macos 1.1.0 [flutter flutter_secure_storage_platform_interface] - flutter_secure_storage_platform_interface 1.0.0 [flutter plugin_platform_interface] - flutter_secure_storage_web 1.0.2 [flutter flutter_web_plugins flutter_secure_storage_platform_interface js] - flutter_secure_storage_windows 1.1.2 [flutter flutter_secure_storage_platform_interface] - flutter_svg 0.23.0+1 [flutter meta path_drawing vector_math xml] - flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta typed_data vector_math] - freezed_annotation 1.1.0 [collection json_annotation meta] - glob 2.0.2 [async collection file path string_scanner] - html 0.15.0 [csslib source_span] - http_parser 4.0.0 [charcode collection source_span string_scanner typed_data] - image_picker_for_web 2.1.6 [flutter flutter_web_plugins image_picker_platform_interface] - image_picker_platform_interface 2.4.4 [cross_file flutter http plugin_platform_interface] - intl 0.17.0 [clock path] - js 0.6.3 - json_annotation 4.4.0 [meta] - lints 1.0.1 - matcher 0.12.11 [stack_trace] - material_color_utilities 0.1.3 - meta 1.7.0 - mime 1.0.1 - nested 1.0.0 [flutter] - numerus 1.1.1 - package_config 2.0.2 [path] - path 1.8.0 - path_drawing 0.5.1+1 [vector_math meta path_parsing flutter] - path_parsing 0.2.1 [vector_math meta] - path_provider_android 2.0.12 [flutter path_provider_platform_interface] - path_provider_ios 2.0.8 [flutter path_provider_platform_interface] - path_provider_linux 2.1.5 [ffi flutter path path_provider_platform_interface xdg_directories] - path_provider_macos 2.0.5 [flutter path_provider_platform_interface] - path_provider_platform_interface 2.0.3 [flutter platform plugin_platform_interface] - path_provider_windows 2.0.5 [ffi flutter path path_provider_platform_interface win32] - petitparser 4.4.0 [meta] - platform 3.1.0 - plugin_platform_interface 2.1.2 [meta] - pointycastle 3.5.1 [collection convert js] - process 4.2.4 [file path platform] - provider 6.0.2 [collection flutter nested] - pub_semver 2.1.0 [collection meta] - qr 2.1.0 [meta] - quiver 3.0.1+1 [matcher] - share_plus_linux 2.0.4 [share_plus_platform_interface file flutter meta url_launcher] - share_plus_macos 2.0.2 [share_plus_platform_interface flutter] - share_plus_platform_interface 2.0.1 [flutter meta mime plugin_platform_interface] - share_plus_web 2.0.4 [share_plus_platform_interface url_launcher flutter flutter_web_plugins meta] - share_plus_windows 2.0.3 [share_plus_platform_interface flutter meta url_launcher] - sky_engine 0.0.99 - source_span 1.8.1 [collection path term_glyph] - stack_trace 1.10.0 [path] - stream_channel 2.1.0 [async] - string_scanner 1.1.0 [charcode source_span] - stripe_android 2.2.0 [flutter] - stripe_ios 2.2.0 [flutter] - stripe_platform_interface 2.2.0 [flutter freezed_annotation json_annotation meta plugin_platform_interface] - term_glyph 1.2.0 - test_api 0.4.8 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher] - timezone 0.8.0 [path] - tuple 2.0.0 [quiver] - typed_data 1.3.0 [collection] - uni_links_platform_interface 1.0.0 [flutter plugin_platform_interface] - uni_links_web 0.1.0 [flutter flutter_web_plugins uni_links_platform_interface] - url_launcher_android 6.0.15 [flutter url_launcher_platform_interface] - url_launcher_ios 6.0.15 [flutter url_launcher_platform_interface] - url_launcher_linux 3.0.0 [flutter url_launcher_platform_interface] - url_launcher_macos 3.0.0 [flutter url_launcher_platform_interface] - url_launcher_platform_interface 2.0.5 [flutter plugin_platform_interface] - url_launcher_web 2.0.9 [flutter flutter_web_plugins url_launcher_platform_interface] - url_launcher_windows 3.0.0 [flutter url_launcher_platform_interface] - vector_math 2.1.1 - very_good_analysis 2.4.0 - video_player 2.2.19 [flutter html video_player_android video_player_avfoundation video_player_platform_interface video_player_web] - video_player_android 2.3.0 [flutter video_player_platform_interface] - video_player_avfoundation 2.3.0 [flutter video_player_platform_interface] - video_player_platform_interface 5.1.0 [flutter plugin_platform_interface] - video_player_web 2.0.7 [flutter flutter_web_plugins video_player_platform_interface] - wakelock 0.6.1+1 [flutter meta wakelock_macos wakelock_platform_interface wakelock_web wakelock_windows] - wakelock_macos 0.4.0 [flutter flutter_web_plugins wakelock_platform_interface] - wakelock_platform_interface 0.3.0 [flutter meta] - wakelock_web 0.4.0 [flutter flutter_web_plugins js wakelock_platform_interface] - wakelock_windows 0.2.0 [flutter wakelock_platform_interface win32] - watcher 1.0.1 [async path] - webview_flutter 2.8.0 [flutter webview_flutter_android webview_flutter_platform_interface webview_flutter_wkwebview] - webview_flutter_android 2.8.3 [flutter webview_flutter_platform_interface] - webview_flutter_platform_interface 1.8.1 [flutter plugin_platform_interface] - webview_flutter_wkwebview 2.7.1 [flutter webview_flutter_platform_interface] - win32 2.4.1 [ffi] - xdg_directories 0.2.0+1 [meta path process] - xml 5.3.1 [collection meta petitparser] - yaml 3.1.0 [collection source_span string_scanner] ```

darshankawar commented 2 years ago

Thanks for the detailed report. I do see the same behavior using latest analytics plugin version.

Similar / related which was fixed: https://github.com/FirebaseExtended/flutterfire/issues/7442

/cc @Salakar

russellwheatley commented 2 years ago

Hey @apetroaeiandrei, this isn't something we have control over. We simply pass a null userId value to iOS & android which should then sets it in the SDK. I suggest raising an issue on the respective SDK repositories (iOS & android).