Funnel & Attribution Analytics
Track anonymous storefront funnels, UTM attribution and product conversion.
Endpoints
| Method | Endpoint | Description | Authentication Required |
|---|---|---|---|
| POST | /api/v1/analytics/events |
Ingest storefront analytics events | No |
| GET | /api/v1/admin/analytics/funnel |
Conversion funnel report | Yes (Admin) |
| GET | /api/v1/admin/analytics/attribution |
UTM/referrer attribution report | Yes (Admin) |
| GET | /api/v1/admin/analytics/products |
Product view → cart → purchase conversion | Yes (Admin) |
Endpoint Details
1. Event ingestion
POST
/api/v1/analytics/events
{
"consent": true,
"events": [
{
"eventType": "PRODUCT_VIEW",
"sessionId": "sess_123",
"productId": "product-uuid",
"path": "/products/phone",
"referrer": "https://google.com",
"utmSource": "google",
"utmMedium": "cpc",
"utmCampaign": "spring",
"locale": "en",
"occurredAt": "2026-05-01T10:00:00"
}
]
}
Event types:
PAGE_VIEWPRODUCT_VIEWSEARCHADD_TO_CARTCHECKOUT_STARTPURCHASESIGNUP
sessions are distinct sessionId values, so multiple events from one visitor count once per
funnel stage.
Ingestion is skipped when consent is false or the request is identified as bot/crawler traffic
(common bot user agents). Rejected events return { "accepted": 0, "rejected": N } so storefronts
can treat this as a successful no-op.
2. Funnel
GET
/api/v1/admin/analytics/funnel?startDate=2026-05-01&endDate=2026-05-31
{
"startDate": "2026-05-01",
"endDate": "2026-05-31",
"stages": [
{ "name": "page_view", "sessions": 1000, "conversionFromPrevious": null },
{ "name": "product_view", "sessions": 420, "conversionFromPrevious": 42.0 },
{ "name": "add_to_cart", "sessions": 180, "conversionFromPrevious": 42.86 },
{ "name": "checkout_start", "sessions": 90, "conversionFromPrevious": 50.0 },
{ "name": "purchase", "sessions": 45, "conversionFromPrevious": 50.0 }
],
"overallConversion": 4.5
}
purchase counts paid, non-canceled orders in the range.
3. Attribution
GET
/api/v1/admin/analytics/attribution?startDate=...&endDate=...
{
"startDate": "2026-05-01",
"endDate": "2026-05-31",
"rows": [
{
"source": "google",
"medium": "cpc",
"campaign": "spring",
"orders": 12,
"revenue": "1440.00",
"revenueUsd": "1200.00"
}
],
"totalOrders": 12,
"totalRevenueUsd": "1200.00"
}
Revenue is normalized to USD via the order FX rate.
4. Product conversion
GET
/api/v1/admin/analytics/products?startDate=...&endDate=...&limit=20
addToCart— distinctADD_TO_CARTeventspurchases— units in paid ordersconversionRate— purchases / viewsrevenue— paid-order item revenue (USD)
Checkout attribution
CheckoutRequest accepts an optional first-touch attribution block:
{
"attribution": {
"sessionId": "sess_123",
"source": "google",
"medium": "cpc",
"campaign": "spring",
"referrer": "https://google.com"
}
}
The values are stored on the order and returned as attributionSource,
attributionMedium and attributionCampaign.