Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.cevoid.com/llms.txt

Use this file to discover all available pages before exploring further.

Use this guide when you want to send completed purchase events from your storefront to Cevoid. This guide focuses on implementation flow. For the full trackSale() payload reference, use Tracking Events.

When to use trackSale()

Call trackSale() when a purchase is completed and you have a final order record. Typical places include:
  • Order confirmation pages
  • Checkout success callbacks
  • Server-confirmed storefront completion handlers
Do not call trackSale() before the order is actually completed.

1. Initialize the SDK

Initialize the SDK once before sending the conversion event.
import { init } from '@cevoid/analytics-sdk'

init({
  publishableKey: 'cev_pk_...'
})

2. Optionally identify the shopper

If you already know the shopper identity, call identify() first so the conversion event can include that context.
import { identify } from '@cevoid/analytics-sdk'

identify({
  profileId: 'profile_123',
  externalId: 'shopify_customer_456'
})
This is optional, but useful when you want to connect storefront conversions to a known customer record.

3. Send the sale event

Use trackSale() with the final order data.
import { trackSale } from '@cevoid/analytics-sdk'

trackSale({
  orderId: 'order_123',
  marketId: 'market_123',
  customerId: 'cust_456',
  currency: 'USD',
  revenue: 129.99,
  skus: ['SKU-1', 'SKU-2']
})
Required fields:
  • orderId
  • currency
  • revenue
Optional fields:
  • marketId
  • customerId
  • skus
revenue must be sent as a decimal major-unit amount in the same currency as currency, such as 129.99 USD.

4. Choose a stable trigger point

Only send one conversion event per completed order. Recommended trigger points:
  • A confirmed order-complete route
  • A checkout success page after payment confirmation
  • A purchase completion event from your commerce platform
Avoid sending trackSale() from:
  • Cart pages
  • Checkout start events
  • Optimistic client-side states before the order is confirmed

Example: storefront confirmation page

import { init, identify, trackSale } from '@cevoid/analytics-sdk'

init({ publishableKey: 'cev_pk_...' })

identify({
  externalId: order.customerExternalId
})

trackSale({
  orderId: order.id,
  marketId: order.marketId,
  customerId: order.customerId,
  currency: order.currency,
  revenue: order.total,
  skus: order.items.map((item) => item.sku).filter(Boolean)
})

Common mistakes

  • Firing the event before payment is confirmed
  • Sending duplicate conversions on page reload
  • Sending the wrong currency for the revenue amount
  • Sending formatted currency strings instead of numeric revenue