Revenue turns "variant B got more clicks" into "variant B made more money". CROforce reads it from the purchase event: each one is an order, and its value is what the order was worth.
On Shopify? Skip to Shopify tracks purchases for you. Don't add the code below as well.
1. Send the purchase event
On the order confirmation (thank-you) page, once the order has gone through, call:
entailInsights.trackEvent('purchase', {
value: '129.90', // order total
currency: 'USD',
orderId: 'A-10045',
orderNumber: '10045',
createdAt: '2026-11-24T10:15:00Z',
products: [
{ productId: 'tee-01', sku: 'TEE-BLK-M', quantity: 2, price: '39.95', currency: 'USD' },
{ productId: 'cap-07', sku: 'CAP-NVY', quantity: 1, price: '50.00', currency: 'USD' },
],
});The order fields
Field | Type | What it is |
|---|---|---|
| string or number | The order total. This is the revenue CROforce counts when the goal uses Order value. Without it, the order counts as a conversion worth 0. No currency symbol. ( |
| string | The order's currency code, like |
| string | Your system's ID for the order. |
| string | The order number the customer sees. |
| string | When the order was placed, as an ISO 8601 date and time. |
| array | One object per product line in the order: |
| string | Your product's ID. |
| string | The product's SKU. |
| number | How many were bought. |
| string or number | The price of one unit. |
| string | The currency of |
Only value and currency feed the revenue numbers. The other fields are stored with the event, so an order can be matched back to your shop. You can add your own fields too, like coupon.
Send it once per order
Confirmation pages get reloaded and bookmarked. Guard the call so each order is sent once:
function trackPurchaseOnce(order) {
const key = 'croforce-order-' + order.orderId;
try {
if (sessionStorage.getItem(key)) return;
sessionStorage.setItem(key, '1');
} catch (e) { /* storage blocked: send anyway */ }
entailInsights.trackEvent('purchase', order);
}Subscriptions
For the start of a paid subscription, send subscribe with the same fields — value is the first payment, or whatever you want the subscription to be worth.
entailInsights.trackEvent('subscribe', {
value: '49.00',
currency: 'USD',
orderId: 'SUB-2231',
products: [{ productId: 'pro-monthly', quantity: 1, price: '49.00', currency: 'USD' }],
});2. Create a revenue goal
- Go to Set up › Goals and click New Goal.
- Name it, for example "Purchase", and set Conversion type to Purchase.
- Set Count to Every time, so repeat orders by the same customer each count.
- Set Value tracking to Order value — it uses the amount of each order instead of a fixed value.
- Open Tracking, keep Event rules and choose the purchase event under Event. It appears in the list once the first order has arrived.
- Click Create.
More on each field in Goals.
Shopify tracks purchases for you
When the CROforce app is installed on Shopify, it sends two events from Shopify's checkout, with no code from you:
Event | Sent when |
|---|---|
| A checkout is completed. |
| A checkout is started. |
Both carry value (the checkout total), currency, subtotal, tax, shipping, orderId, orderNumber, orderToken, createdAt, the shipping country and country_code, and the line items as items (each with item_id, item_name, price, currency, quantity and sku). Purchases also carry discount.
So on Shopify you only need step 2: a Purchase goal with Order value on the purchase event. Your products are synced too — see Products catalogue.
3. Check that orders arrive
- Place a test order.
- After a minute or two, open Set up › Goals: your Purchase goal shows Tracking, and its Conversions and Revenue go up.
Nothing arriving? Check DevTools › Network for a request to t.entail-insights.com when the confirmation page loads, and see Troubleshooting.
Next steps
- Track custom events: trackEvent in JavaScript, React and TypeScript.
- Built-in goal types: All 17 event names.
- Read test results: See revenue per variant.
Frequently asked questions
Do I need to add purchase code on Shopify?
No. The CROforce Shopify app sends a purchase event when a checkout completes. Adding your own code as well counts every order twice.
Should value be a number or a string?
Either works. The built-in example uses a string with two decimals, like '129.90'. Send the order total without a currency symbol.
What if I don't send a currency?
CROforce uses your website's default currency.
How do I avoid counting an order twice when the confirmation page reloads?
Send the event once per order — for example, remember the order ID in sessionStorage and skip the call if it's already there.
