SDK Integration
Flutter SDK Setup
pubspec.yaml:- Events batched in memory (max 20 events or 30 seconds)
- On app background: Immediate flush
- On network failure: Persist to SQLite, retry with exponential backoff
- Battery-conscious: Batching reduces network calls by 90%
App Lifecycle Events
App Installed
When: First app launch after install (SDK auto-tracks) What’s tracked automatically:App Opened
When: App moves from background to foreground Auto-tracked by SDK (ifautoTrackAppLifecycle: true):
App Backgrounded
When: User switches to another app or locks screen- Session duration distribution
- Screens per session
- Features used per session
- Session → Conversion rate
Screen Tracking
Automatic Screen Tracking (Recommended)
Enable in SDK config:Manual Screen Tracking (Granular Control)
Use case: You want to add screen-specific properties (product ID, category, etc.)Feature Usage Events
Feature Discovered
When: User views feature for first time (onboarding, tutorial, tooltip)Feature Used
When: User actively engages with featureSearch Performed
When: User submits search queryContent Shared
When: User shares via native share sheetPush Notification Events
Push Permission Requested
When: App asks for notification permissionPush Permission Granted/Denied
When: User responds to system permission promptPush Received
When: Push notification arrives (app in foreground or background)Push Opened
When: User taps notification (SDK auto-tracks) Auto-tracked:Offline Behavior
Event Queueing
SDK handles offline automatically:- Network unavailable: Events persisted to SQLite
- Battery optimization: Batch 20 events per network call
- Retry logic: Exponential backoff (1s, 2s, 4s, 8s, 16s)
- Max retries: 10 attempts, then discard (prevents infinite queue growth)
Offline Analytics
Track offline sessions separately:Performance Monitoring
Screen Load Time
API Call Performance
Implementation Checklist
Phase 1: Core Tracking (Week 1)
- SDK integration (initialization, config)
- App Installed, Opened, Backgrounded
- Screen tracking (auto or manual)
- User identification on signup/login
- Device token registration
Phase 2: Feature Instrumentation (Week 2)
- Feature Used events (top 5 features)
- Search Performed
- Content Shared
- Purchase flow events (Product Viewed, Added to Cart, Purchased)
- Profile attribute updates (plan type, feature usage)
Phase 3: Push Notifications (Week 3)
- Permission request flow (soft ask + system prompt)
- Push Received, Opened tracking
- Deep link handling
- Campaign: Onboarding push sequence
- Campaign: Cart abandonment push
Phase 4: Optimization (Week 4)
- Performance monitoring (screen load, API calls)
- Offline behavior handling
- Event batching tuning
- Retention analysis (DAU/MAU, cohorts)
- Push notification A/B testing
Next: SaaS product tracking patterns → SaaS Product Tracking