Skip to content

Event Tracking

Overview

The recommendation engine improves over time by learning from shopper interactions. The storefront widget tracks events automatically, but you can also send events via the API for headless storefronts or custom integrations.

Track Event

POST /api/events

Request Body

{
"type": "click",
"productId": "gid://shopify/Product/123456",
"sessionId": "abc-123",
"customerId": "gid://shopify/Customer/789",
"widgetId": "widget-product-page",
"metadata": {}
}

Event Types

TypeDescriptionWhen to Send
impressionRecommendations were displayed to the shopperWidget renders
clickShopper clicked a recommended productProduct card click
add_to_cartShopper added a recommended product to cartAdd-to-cart action
purchaseRecommended product was purchasedOrder confirmation
dismissShopper dismissed a recommendationDismiss/hide action
saveShopper saved a recommendation for laterSave/bookmark action

Fields

FieldTypeRequiredDescription
typestringYesEvent type (see above)
productIdstringYesThe Shopify product ID
sessionIdstringYesUnique session identifier
customerIdstringNoShopify customer ID (if logged in)
widgetIdstringNoThe widget placement that generated the event
metadataobjectNoAdditional context (e.g., position in carousel)

Response

{
"success": true,
"eventId": "evt_abc123"
}

Batch Events

For high-volume tracking, you can send multiple events in a single request:

POST /api/events/batch
{
"events": [
{ "type": "impression", "productId": "123", "sessionId": "abc" },
{ "type": "click", "productId": "456", "sessionId": "abc" }
]
}

Maximum 100 events per batch request.