Skip to content

Commit

Permalink
fix: Add hunger game analytics event and track it (#5004)
Browse files Browse the repository at this point in the history
* fix:4682 Add hunger game analytics event and track it

* Update packages/smooth_app/lib/pages/preferences/user_preferences_contribute.dart

Co-authored-by: monsieurtanuki <fabrice_fontaine@hotmail.com>

---------

Co-authored-by: monsieurtanuki <fabrice_fontaine@hotmail.com>
  • Loading branch information
AshAman999 and monsieurtanuki committed Jan 25, 2024
1 parent 9354d30 commit 0ea1967
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 6 additions & 1 deletion packages/smooth_app/lib/helpers/analytics_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ enum AnalyticsCategory {
newProduct(tag: 'new product'),
robotoff(tag: 'robotoff'),
list(tag: 'list'),
deepLink(tag: 'deep link');
deepLink(tag: 'deep link'),
hungerGame(tag: 'hunger game');

const AnalyticsCategory({required this.tag});

Expand Down Expand Up @@ -136,6 +137,10 @@ enum AnalyticsEvent {
questionClicked(
tag: 'question clicked',
category: AnalyticsCategory.robotoff,
),
hungerGameOpened(
tag: 'hunger game opened',
category: AnalyticsCategory.hungerGame,
);

const AnalyticsEvent({required this.tag, required this.category});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:smooth_app/data_models/preferences/user_preferences.dart';
import 'package:smooth_app/database/local_database.dart';
import 'package:smooth_app/generic_lib/design_constants.dart';
import 'package:smooth_app/generic_lib/dialogs/smooth_alert_dialog.dart';
import 'package:smooth_app/helpers/analytics_helper.dart';
import 'package:smooth_app/helpers/global_vars.dart';
import 'package:smooth_app/helpers/launch_url_helper.dart';
import 'package:smooth_app/pages/hunger_games/question_page.dart';
Expand Down Expand Up @@ -288,8 +289,13 @@ class UserPreferencesContribute extends AbstractUserPreferences {
context: context,
builder: (BuildContext context) => _ContributorsDialog(),
);

Future<void> _hungerGames() async => openQuestionPage(context);
Future<void> _hungerGames() async {
// Track the hunger game analytics event
AnalyticsHelper.trackEvent(
AnalyticsEvent.hungerGameOpened,
);
await openQuestionPage(context);
}

UserPreferencesItem _getListTile(
final String title,
Expand Down

0 comments on commit 0ea1967

Please sign in to comment.