Event Handling
Applications should subscribe to SDK events to support analytics, experimentation, and debugging.
Event Types
The SDK emits the following lifecycle and commerce events:
| Event | Description |
|---|---|
impression | Widget rendered on screen |
viewability_reached | Widget entered the viewport |
product_click | User tapped a product |
conversation_step_viewed | User advanced the conversation |
cta_clicked | Call-to-action interaction |
redirect_started | Navigation to PDP initiated |
checkout_opened | Embedded checkout launched |
checkout_completed | Purchase transaction succeeded |
checkout_abandoned | User exited checkout without completing |
error_surfaced | Runtime error occurred |
Example Event Payload
{
"type": "checkout_completed",
"placementId": "cart-sponsored-offer",
"productId": "prod_123",
"campaignId": "cmp_456",
"sessionId": "session_123",
"timestamp": "2026-03-24T10:15:30Z"
}Subscribing to Events
Pass an onEvent callback during SDK initialization to receive all events:
<ProductAdsProvider
apiKey={process.env.PRODUCT_ADS_API_KEY!}
onEvent={(event) => {
analytics.track(event.type, event);
}}
>
{children}
</ProductAdsProvider>Recommended Destinations
Forward SDK events to one or more of the following systems:
- Internal analytics pipeline
- Product analytics platform
- Ad reporting pipeline
- Attribution systems
- Experimentation framework
Last updated on