Analytics Configuration
Configure analytics tracking in the Snoopr SDK.
Overview
The SDK automatically tracks Story interactions when analytics is enabled. This guide covers configuration options and how to customize tracking behavior.
Basic Setup
Analytics is enabled by default. No additional setup required:
<SnooprProvider appId="app-xxx" apiKey="sk_live_xxx">
{/* Analytics enabled automatically */}
</SnooprProvider>Configuration Options
Enable/Disable Analytics
<SnooprProvider
appId="app-xxx"
apiKey="sk_live_xxx"
enableAnalytics={true} // Default: true
>Set to false to disable all event tracking. Useful for:
- Development builds where you don't want test data
- Users who opt out of analytics
- Compliance with regional privacy requirements
Debug Mode
<SnooprProvider
appId="app-xxx"
apiKey="sk_live_xxx"
analyticsDebug={true} // Default: false
>When enabled, logs all analytics events to the console prefixed with [Snoopr]:
[Snoopr] Analytics: carousel_viewed { carouselId: "abc", screenCount: 5 }
[Snoopr] Analytics: screen_viewed { screenIndex: 0, screenId: "intro" }User Identification
Associate events with your user IDs for cross-device tracking:
// After login
Snoopr.identify('user-123', {
plan: 'premium',
cohort: 'jan-2026'
})Before identify() is called, events are tracked with an anonymous device ID. After identification, both device ID and user ID are attached to events.
Reset on Logout
await Snoopr.reset()This clears the user ID and generates a new session. Call this when users log out.
Custom Event Tracking
Track additional events beyond automatic Story tracking:
// Track custom events
await Snoopr.trackEvent('feature_discovered', {
feature: 'dark_mode',
source: 'settings'
})
// Track screen views in your app
await Snoopr.trackScreenView('ProductDetails')Custom events appear in your analytics dashboard and can be used for trigger-based Stories (coming soon).
How Events Are Sent
The SDK batches events for efficiency:
| Setting | Value |
|---|---|
| Batch size | 10 events |
| Batch interval | 30 seconds |
| Max queue | 50 events |
| Retry attempts | 3 with exponential backoff |
| Event expiration | 7 days |
Events are queued in AsyncStorage and persist across app restarts. The SDK automatically retries failed sends.
Offline Support
Events captured while offline are queued locally. When connectivity returns, queued events are sent in batches.
Rate Limits
The SDK enforces rate limits to prevent runaway tracking:
| Limit | Value |
|---|---|
| Max events per minute | 100 |
| Max event size | 256 KB |
| Max batch size | 100 events (server) |
Events exceeding limits are dropped with a console warning in debug mode.
New to Snoopr Analytics? See the Analytics Overview for dashboard features.
Related
- Event Reference - All tracked events
- A/B Testing - Experiment analytics
- Analytics Overview - Dashboard features and metrics