Analytics
Analytics and crash reporting with Firebase Analytics, Crashlytics, Sentry, or PostHog. Event tracking, user properties, screen views, crash reports, error logging. Plug-and-play provider architecture. Use when implementing analytics, crash reporting, or switching providers.From its SKILL.md
npx -y skills add launch52-ai/flutter-template --skill analyticsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- reads credentialsReads from 2 credential sources: `SENTRY_DSN` and 1 more.
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
5.5 KB, ~1.3k tokens by cl100k_base, as published. Nobody here has run it
Analytics & Crash Reporting
Track user behavior, monitor app health, and debug production issues. Supports multiple providers with a plug-and-play architecture.
When to Use This Skill
- Adding analytics to a Flutter app
- Setting up crash/error reporting
- Implementing custom event tracking
- Switching analytics providers
- User asks "add analytics", "track events", "crash reporting", "Sentry", or "PostHog"
Questions to Ask
- Analytics provider: Firebase Analytics (default), PostHog, or Mixpanel?
- Error tracking provider: Firebase Crashlytics (default) or Sentry?
- Analytics scope: Full analytics (events + properties + screens) or just crash reporting?
- Custom events: What key user actions need tracking? (purchases, signups, feature usage)
- Privacy: GDPR/CCPA compliance needed? User consent flow required?
Provider Quick Reference
| Need | Recommended | Why |
|---|---|---|
| Just get started | Firebase | Free, easy setup |
| Better product analytics | PostHog | Funnels, retention, session replay |
| Better error tracking | Sentry | Superior debugging |
| Data ownership | PostHog (self-hosted) | Your servers |
See: providers-guide.md for detailed comparison.
Reference Files
reference/services/- Provider-agnostic interface + implementations (Firebase, Sentry, PostHog)reference/repositories/- Domain interface + implementationsreference/providers/- Riverpod state managementreference/failures/- Sealed Failure typesreference/utils/- Route observer, consent helpers
Workflow
Phase 1: Choose Providers
- Select analytics provider (Firebase Analytics / PostHog / Mixpanel)
- Select error tracking provider (Crashlytics / Sentry)
- Add dependencies to
pubspec.yaml
Phase 2: Platform Config
Firebase:
- Add
GoogleService-Info.plist(iOS) andgoogle-services.json(Android) - Configure dSYM upload for Crashlytics
Sentry:
- Get DSN from Sentry dashboard
- Configure sentry-cli for dSYM upload
PostHog:
- Get API key from PostHog dashboard
- Optional: Configure self-hosted URL
Phase 3: Implementation
- Copy provider-agnostic interface + chosen implementations
- Initialize services in
main.dart - Wire up Riverpod providers
- Add screen tracking via router observer
- Implement event tracking for key actions
- Test error reporting
Core API (Provider-Agnostic)
final analytics = ref.read(analyticsServiceProvider);
final errorTracking = ref.read(errorTrackingServiceProvider);
await analytics.logEvent(name: 'purchase_completed', parameters: {'item_id': 'sku_123'});
await analytics.setUserProperty(name: 'tier', value: 'premium');
await analytics.logScreenView(screenName: 'HomeScreen');
await errorTracking.recordError(error, stackTrace, reason: 'API failed');
await errorTracking.addBreadcrumb('User tapped checkout');
Dependencies by Provider
Firebase (default):
dependencies:
firebase_core: ^3.9.0
firebase_analytics: ^11.4.0
firebase_crashlytics: ^4.3.0
Sentry:
dependencies:
sentry_flutter: ^8.12.0
PostHog:
dependencies:
posthog_flutter: ^4.0.0
Mixed (PostHog + Sentry):
dependencies:
posthog_flutter: ^4.0.0
sentry_flutter: ^8.12.0
Swapping Providers
Change the provider in Riverpod to swap implementations:
@riverpod
ProductAnalyticsService analyticsService(Ref ref) => FirebaseAnalyticsService.instance;
// Alternative: PostHogAnalyticsService.instance
@riverpod
ErrorTrackingService errorTrackingService(Ref ref) => FirebaseCrashlyticsService.instance;
// Alternative: SentryErrorTrackingService.instance
Guides
| File | Content |
|---|---|
| providers-guide.md | Provider comparison & selection |
| implementation-guide.md | Step-by-step code setup |
| firebase-setup-guide.md | Firebase Console configuration |
| local-setup-guide.md | Xcode Build Phase setup for dSYMs |
| checklist.md | Verification checklist |
For CI/CD integration: See /ci-cd skill → debug-symbols-guide.md
Checklist
Core:
- Provider selected (analytics + error tracking)
- Dependencies added to pubspec.yaml
- Services initialized in main.dart
- FlutterError.onError configured
- PlatformDispatcher.instance.onError configured
- Screen tracking via router observer
- Key events tracked
- User ID set on login/logout
Firebase-specific:
-
GoogleService-Info.plistadded -
google-services.jsonadded - dSYM upload script in Xcode Build Phases
Sentry-specific:
- SENTRY_DSN configured
- sentry-cli installed for dSYM upload
- Release/environment configured
PostHog-specific:
- POSTHOG_API_KEY configured
- Host URL set (if self-hosted)
Related Skills
/push-notifications- Firebase project setup (shared)/release- iOS build phases, Android signing/ci-cd- dSYM upload automation/design- Consent dialogs, settings UI/i18n- Localized consent text/testing- Mock analytics for tests
What ships with it: 19 files
74.1 KB alongside SKILL.md, 3 of them executable
reference/
- failures/analytics_failures.dart1.8 KB
- providers/analytics_providers.dart4.8 KB
- repositories/analytics_repository.dart1.4 KB
- repositories/analytics_repository_impl.dart4.1 KB
- repositories/mock_analytics_repository.dart3.9 KB
- services/error_tracking_service.dart2.3 KB
- services/firebase_analytics_service.dart3.3 KB
- services/firebase_crashlytics_service.dart2.7 KB
- services/posthog_analytics_service.dart3.4 KB
- services/sentry_error_tracking_service.dart3.4 KB
- utils/analytics_observer.dart2.8 KB
scripts/
- upload_dsyms_crashlytics.shruns2.3 KB
- upload_dsyms_sentry.shruns2.1 KB
- upload_mapping_android.shruns2.8 KB
- checklist.md4.2 KB
- firebase-setup-guide.md5.9 KB
- implementation-guide.md12.3 KB
- local-setup-guide.md3.8 KB
- providers-guide.md7.0 KB