Events & Analytics
The SDK includes a batched event tracking system that automatically collects lifecycle events and supports custom event tracking.How It Works
TheEventService queues events in memory and flushes them in batches of 20 every 30 seconds:
track()adds an event to the pending queue- When the queue reaches 20 events, it flushes immediately
- Every 30 seconds, any pending events are flushed
- If a flush fails, events are persisted to AsyncStorage and retried on next init
- On
StackfrontProviderunmount, remaining events are flushed
Automatic Events
| Event | When | Who |
|---|---|---|
app_opened | SDK initialization complete | Provider |
login | useCustomer().login() succeeds | Hook |
logout | useCustomer().logout() completes | Hook |
account_created | useCustomer().createAccount() succeeds | Hook |
Custom Events
Event Shape
sessionId is generated once when the provider mounts and persists for the app session.
Service API
Best Practices
- Use descriptive event names in
snake_case - Limit properties to primitive types and flat structures
- Avoid tracking personally identifiable information (PII) in properties
- The event pipeline is fire-and-forget — errors are silently handled and retried