Choosing a Delivery Mode
Event-Based Delivery
Events are pushed to your webhook as they occur, in near real-time.Pros:
- Low latency for real-time applications.
- Immediate access to individual events.
- Requires you to perform session stitching.
- You must calculate session-level metrics (like time on page).
Session-Based Delivery (Recommended)
Events are grouped by session and sent in a single payload after the session ends (typically 30 minutes of inactivity).Pros:
- Session metrics are pre-computed for you.
- Data is fully enriched and ready for analysis.
- Simpler to process and store.
Example: Pageview Event (Session-Based)
This example shows a session payload containing a single$pageview
event. Note the enriched context and pre-computed engagement times.
Pageview Event
Example: Custom Event (Session-Based)
This example shows how a customtrack
event appears in a session payload. The data from the second argument of the track
call is nested inside event_properties
.
Custom Event