Skip to content

Instantly share code, notes, and snippets.

@arafaysaleem
Last active December 23, 2024 07:45
Show Gist options
  • Save arafaysaleem/a6c0cabe3478425b035d60f6394946a0 to your computer and use it in GitHub Desktop.
Save arafaysaleem/a6c0cabe3478425b035d60f6394946a0 to your computer and use it in GitHub Desktop.
Analytics Base Client for Flutter
abstract class AnalyticsClientBase {
/// Toggles the collection of analytics data.
Future<void> toggleAnalyticsCollection(bool enabled);
/// Identifies the user with the given [userId].
Future<void> identifyUser({
required String userId,
required String email,
required String role,
});
/// Resets the user.
Future<void> resetUser();
/// Tracks a generic event with the given [eventName] and [eventData].
Future<void> trackEvent(String eventName, [Map<String, Object>? eventData]);
/// Tracks a screen view with the given [routeName] and [action].
Future<void> trackScreenView(String routeName, String action);
/// Tracks a bottom sheet view with the given [routeName] and [data].
Future<void> trackBottomSheetView(String routeName, [Map<String, Object>? data]);
/// Tracks a dialog view with the given [dialogName] and [data].
Future<void> trackDialogView(String dialogName, [Map<String, Object>? data]);
/// Tracks the app being foregrounded.
Future<void> trackAppForegrounded();
/// Tracks the app being backgrounded.
Future<void> trackAppBackgrounded();
/// Tracks a button press with the given [buttonName] and [data].
Future<void> trackButtonPressed(String buttonName, [Map<String, Object>? data]);
/// Tracks the permission being granted with status.
Future<void> trackPermissionRequest(String permission, String status);
/// Tracks the onboarding screen view.
Future<void> trackNewAppOnboarding();
/// Tracks the creation of an app.
Future<void> trackAppCreated();
/// Tracks the update of an app.
Future<void> trackAppUpdated();
/// Tracks the deletion of an app.
Future<void> trackAppDeleted();
/// Tracks the completion of a task with the given [completedCount].
Future<void> trackTaskCompleted(int completedCount);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment