PageTracker is the recommended approach for most tracking, you can also track custom events directly using the track(event:properties:) method.
Basic Tracking
Schema Validation
When to Use Direct Event Tracking
Use direct event tracking for:- Events that don’t fit the page view model
- Background events (app state changes, push notifications)
- One-off events without context
- Events outside of a view lifecycle
Tracking Events
Basic Event
Event with Properties
Event Naming Rules
Event names must follow these rules:- Only alphanumeric characters and underscores:
[a-zA-Z0-9_] - Cannot start with a number
- Case-sensitive
- Valid Names
- Invalid Names
Schema Validation
Enable Debug Logging
Schema Error Example
When properties don’t match the schema:Checking Events Were Accepted
Successful events show:Common Event Types
App Lifecycle Events
User Action Events
Push Notification Events
Purchase Events
Event Enrichment
Add server-side enrichment to events:Batching and Delivery
Events are:- Queued locally when tracked
- Sent in batches to reduce network overhead
- Persisted to disk if the app closes before sending
- Retried automatically on network failure
Error Handling
Best Practices
- Do
- Don't
- Use descriptive, consistent event names
- Match your dashboard schema exactly
- Test events with debug logging enabled
- Handle errors gracefully
- Use PageTracker for view-based tracking
- Keep properties minimal and relevant
Troubleshooting
Events not appearing in dashboard
Events not appearing in dashboard
Problem: Tracked events don’t show up.Solutions:
- Enable debug logging and look for
Accepted: X / X - Check for schema validation errors in logs
- Wait up to 5 minutes for processing
- Verify you’re in the correct workspace
EventProperties init fails
EventProperties init fails
Problem: Creating EventProperties throws an error.Solutions:
- Verify all values are supported types
- Check for unsupported custom objects
- Ensure arrays contain only supported types
Events rejected with schema error
Events rejected with schema error
Problem: Events sent but rejected by server.Solutions:
- Check event name matches schema exactly
- Verify property names and types
- Remove properties not in the schema
- Check for typos
Related Documentation
Page Tracking
View-based tracking with PageTracker
Event Properties
Structuring event metadata
Video Tracking
Track video content
Issues
Common problems and solutions