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.
Event-based and session-based payloads share the same structure. The difference is that event-based payloads contain a single event in the
events array and are sent in near real-time, while session-based payloads contain all events from the session and are sent after 30 minutes of inactivity.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: Identified Visitor (Session-Based)
When a visitor is identified — for example via theidentify SDK method or an sn_email query parameter — user_properties includes their $email and any $traits at both the session and event level.
Identified Visitor
Example: Form Submit Event (Session-Based)
This example shows how a form submit event appears in a session payload.Form Submit 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
Example: Click Event (Session-Based)
This example shows how a click event appears in a session payload whenclickTracking is enabled.
Click Event
Example: Download Event (Session-Based)
This example shows how a download event appears in a session payload whendownloadTracking is enabled.
Download Event