feat: PostHog analytics wiring across all key screens
- Commit untracked posthog_service.dart (fire-and-forget HTTP client,
EU data residency, already used by auth for identify/reset)
- screen() calls: Home, Contribute, Profile, EventDetail (with event_id)
- capture('event_tapped') on hero carousel card tap (source: hero_carousel)
- capture('book_now_tapped') in _navigateToCheckout (event_id + name)
- capture('review_submitted') in _handleSubmit (event_id + rating)
- Covers all 4 expansion items from security audit finding 8.2
This commit is contained in:
@@ -18,6 +18,7 @@ import '../features/reviews/widgets/review_section.dart';
|
||||
import '../widgets/tier_avatar_ring.dart';
|
||||
import 'contributor_profile_screen.dart';
|
||||
import 'checkout_screen.dart';
|
||||
import '../core/analytics/posthog_service.dart';
|
||||
|
||||
class LearnMoreScreen extends StatefulWidget {
|
||||
final int eventId;
|
||||
@@ -37,6 +38,10 @@ class _LearnMoreScreenState extends State<LearnMoreScreen> with SingleTickerProv
|
||||
void _navigateToCheckout() {
|
||||
if (!AuthGuard.requireLogin(context, reason: 'Sign in to book this event.')) return;
|
||||
if (_event == null) return;
|
||||
PostHogService.instance.capture('book_now_tapped', properties: {
|
||||
'event_id': _event!.id,
|
||||
'event_name': _event!.name ?? _event!.title ?? '',
|
||||
});
|
||||
Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (_) => CheckoutScreen(
|
||||
eventId: _event!.id,
|
||||
@@ -71,6 +76,7 @@ class _LearnMoreScreenState extends State<LearnMoreScreen> with SingleTickerProv
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
PostHogService.instance.screen('EventDetail', properties: {'event_id': widget.eventId});
|
||||
_fadeController = AnimationController(vsync: this, duration: const Duration(milliseconds: 350));
|
||||
_fade = CurvedAnimation(parent: _fadeController, curve: Curves.easeIn);
|
||||
_pageNotifier = ValueNotifier(0);
|
||||
|
||||
Reference in New Issue
Block a user