feat(client/analytics): GA4 funnel instrumentation + unified home CTA
Add Firebase Analytics (GA4) funnel tracking to client_app: - AnalyticsService typed wrapper (enum-gated, no PII) + analyticsProvider - FirebaseAnalyticsObserver on GoRouter (screen_name via nameExtractor) - user_id = customer UUID, user_type property, set on auth resolve/upgrade - funnel events: curhat_start, curhat_repeat_start, auth_*, onboarding_usp_view, payment_view, payment_method_select, payment_started, pairing_matched/no_bestie - bottom-sheet events: verif_choice_view/select, bestie_choice_view/select, extension_offer_view, chat_extension_requested - payment_started carries app_instance_id + ga_session_id in the /payment-requests body for future server-side stitching (backend ignores) - curhat_mode_pick screen name disambiguates the chat/call mode picker (/payment/method-pick) from the payment-channel picker (/payment/method) - unify both home CTAs to "Aku Mau Curhat" Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import '../../../core/analytics/analytics_service.dart';
|
||||
import '../../../core/api/api_client_provider.dart';
|
||||
import '../../../core/auth/auth_notifier.dart';
|
||||
import '../../../core/theme/halo_tokens.dart';
|
||||
@@ -35,6 +36,9 @@ class _DisplayNameScreenState extends ConsumerState<DisplayNameScreen> {
|
||||
final data = next.valueOrNull;
|
||||
if (data is AuthAnonymousData && !_routedAfterLogin) {
|
||||
_routedAfterLogin = true;
|
||||
// Anonymous identity established — activation step 6.
|
||||
// ignore: discarded_futures
|
||||
ref.read(analyticsProvider).logAuthComplete(AnalyticsUserType.anonymous);
|
||||
_proceedAfterLogin();
|
||||
}
|
||||
});
|
||||
@@ -82,12 +86,17 @@ class _DisplayNameScreenState extends ConsumerState<DisplayNameScreen> {
|
||||
return;
|
||||
}
|
||||
|
||||
// ignore: discarded_futures
|
||||
ref.read(analyticsProvider).logVerifChoiceView();
|
||||
final choice = await VerifChoiceSheet.show(context);
|
||||
if (!mounted || choice == null) {
|
||||
// User dismissed the sheet — let them tap Lanjut again to retry.
|
||||
// User dismissed the sheet — let them tap Lanjut again to retry. No
|
||||
// select event: the view→select gap is the abandonment signal.
|
||||
_routedAfterLogin = false;
|
||||
return;
|
||||
}
|
||||
// ignore: discarded_futures
|
||||
ref.read(analyticsProvider).logVerifChoiceSelect(choice);
|
||||
if (!mounted) return;
|
||||
await routeForVerifChoice(context, ref, choice);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user