Skip to main content
The Crave SDK includes a built-in analytics module that tracks key events across the ordering funnel. Use it to measure conversion rates, identify drop-off points, and understand customer behavior.

Event types

The public SDK accepts three cart-authorized interaction events. Crave records ORDER_PLACED server-side only after payment succeeds and the order is created, so clients cannot forge a conversion.

Track events with the SDK

The API returns { "status": "accepted" } after it authorizes the cart and records or deduplicates the event.

Where to fire events

Place analytics calls at these points in your storefront:
Do not send ORDER_PLACED from a browser or mobile client. Poll the authoritative order result for the UI; the API writes the conversion event during server-side order creation.

Custom metadata

The metadata field accepts any key-value pairs. Use it to attach context to events:

Google Analytics integration

Forward Crave events to Google Analytics for unified reporting:
If you also send a Google Analytics purchase event, do so only after checkout.getOrderResult() returns completed; do not forward that event to the Crave public analytics endpoint.

View analytics in the Dashboard

Analytics data is available in the Crave Dashboard under Analytics > Storefront. The dashboard shows:
  • Funnel visualization — conversion rates between each stage
  • Event timeline — raw event stream with metadata
  • Location comparison — performance across multiple locations
  • Time-based trends — daily, weekly, and monthly patterns

Best practices

  • Fire events once — deduplicate using a ref or flag to prevent double-counting on re-renders
  • Don’t block the UI — fire analytics calls without await to keep the interface responsive
  • Include metadata — the more context you attach, the more useful your Dashboard reports
  • Test outside production first — confirm events appear in the intended Dashboard environment

Next steps

Order Tracking

Track order status after checkout.

Deployment

Deploy your storefront and go live.