Skip to main content

Overview

Conversion tracking links purchases back to the search queries and recommendations that drove them. This data powers revenue attribution reporting and improves recommendation models.

Tracking Purchases

Call trackPurchase when an order is completed:

Purchase Parameters

string
required
Unique identifier for the order. Used for deduplication.
number
required
Total order value (sum of all items).
string
required
ISO 4217 currency code (e.g., ‘USD’, ‘EUR’, ‘GBP’).
PurchaseItem[]
required
Array of purchased items.

PurchaseItem

string
required
Product ID matching your catalog.
number
required
Number of units purchased.
number
required
Price per unit at time of purchase.

Attribution

Refine automatically attributes purchases to previous interactions within the attribution window (default: 7 days). The flow:
  1. User searches for “running shoes”
  2. User clicks on product SKU_001
  3. User adds SKU_001 to cart
  4. User completes purchase with SKU_001
The purchase is attributed to the original search.
Attribution works automatically using the visitor/user ID. You don’t need to pass the original serve ID to trackPurchase.

Implementation Examples

Order Confirmation Page

E-commerce Platform Integration

Handling Edge Cases

Duplicate Prevention

Refine deduplicates purchases by orderId. If the same order is tracked multiple times, only the first is recorded.

Partial Orders

Track only the items that were actually fulfilled:

Refunds

For full refunds, no action needed (attribution is preserved for analytics). For partial refunds, you may optionally track a negative adjustment:

Guest Checkout

For guest checkout, the visitor ID automatically links the purchase to previous interactions:

Post-Purchase Identification

If the user creates an account after checkout, call identify to link:

Ensuring Data Delivery

Always flush events after tracking purchases:

Beacon API Fallback

For page unloads, the SDK uses the Beacon API when available:

Testing Conversions

Enable debug mode to verify purchase tracking:

Next Steps

Event Overview

Complete event tracking guide

Analytics Dashboard

View conversion reports