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/auth/auth_notifier.dart';
|
||||
import '../../core/auth/onboarding_intent_provider.dart';
|
||||
import '../../core/availability/mitra_availability_notifier.dart';
|
||||
@@ -81,6 +82,11 @@ class _HomeScreenState extends ConsumerState<HomeScreen> with WidgetsBindingObse
|
||||
/// CTA path for SHomeReturning. Returning users get the bestie-choice sheet
|
||||
/// when they have prior history, otherwise jump to the new-payment shell.
|
||||
Future<void> _onCurhatBestieBaruPressed(BuildContext context) async {
|
||||
// Returning user starting a fresh curhat (repeat funnel). The
|
||||
// bestie_reselect sub-event fires later from the history list if they pick
|
||||
// a known bestie; this marks the top of the repeat funnel.
|
||||
// ignore: discarded_futures
|
||||
ref.read(analyticsProvider).logCurhatRepeatStart();
|
||||
bool hasHistory;
|
||||
try {
|
||||
hasHistory = await ref.read(bestieHistoryHasItemsProvider.future);
|
||||
@@ -89,6 +95,8 @@ class _HomeScreenState extends ConsumerState<HomeScreen> with WidgetsBindingObse
|
||||
}
|
||||
if (!context.mounted) return;
|
||||
if (hasHistory) {
|
||||
// ignore: discarded_futures
|
||||
ref.read(analyticsProvider).logBestieChoiceView();
|
||||
await BestieChoiceSheet.show(context);
|
||||
return;
|
||||
}
|
||||
@@ -101,6 +109,9 @@ class _HomeScreenState extends ConsumerState<HomeScreen> with WidgetsBindingObse
|
||||
/// (the call-sign check); display_name_screen kicks off `loginAnonymous`
|
||||
/// and pushes into the verif-choice sheet.
|
||||
void _onAkuMauCurhatPressed(BuildContext context) {
|
||||
// Top of the activation funnel — fresh user tapping the primary CTA.
|
||||
// ignore: discarded_futures
|
||||
ref.read(analyticsProvider).logCurhatStart(entryPoint: 'home_primary');
|
||||
context.push('/auth/display-name');
|
||||
}
|
||||
|
||||
@@ -172,7 +183,7 @@ class _SHome1stView extends ConsumerWidget {
|
||||
const _GreetingSubtitle(),
|
||||
const SizedBox(height: 32),
|
||||
_PrimaryCTA(
|
||||
label: 'aku mau curhat',
|
||||
label: 'Aku Mau Curhat',
|
||||
enabled: mitraAvailable,
|
||||
onPressed: onCTA,
|
||||
),
|
||||
@@ -395,7 +406,7 @@ class _SHomeReturningView extends ConsumerWidget {
|
||||
activeSessionAsync.when(
|
||||
loading: () => const Center(child: CircularProgressIndicator()),
|
||||
error: (_, __) => _PrimaryCTA(
|
||||
label: 'curhat sama bestie baru',
|
||||
label: 'Aku Mau Curhat',
|
||||
enabled: mitraAvailable,
|
||||
onPressed: onCTA,
|
||||
),
|
||||
@@ -415,7 +426,7 @@ class _SHomeReturningView extends ConsumerWidget {
|
||||
);
|
||||
}
|
||||
return _PrimaryCTA(
|
||||
label: 'curhat sama bestie baru',
|
||||
label: 'Aku Mau Curhat',
|
||||
enabled: mitraAvailable,
|
||||
onPressed: onCTA,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user