Track purchases and revenue

Revenue tracking shows how much money each page, campaign and test version brings in. Send entailInsights.trackEvent('purchase', {…}) on your order confirmation page with the order total in value and its currency, then create a Purchase goal set to Order value. On Shopify, the CROforce app sends purchases for you.

On this page1. Send the purchase event2. Create a revenue goalShopify tracks purchases for you3. Check that orders arriveNext steps

Updated November 28, 2026

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:

JavaScript
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

value

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. (amount is read instead if value is missing.)

currency

string

The order's currency code, like USD, EUR or GBP. If you leave it out, your website's default currency is used.

orderId

string

Your system's ID for the order.

orderNumber

string

The order number the customer sees.

createdAt

string

When the order was placed, as an ISO 8601 date and time.

products

array

One object per product line in the order:

productId

string

Your product's ID.

sku

string

The product's SKU.

quantity

number

How many were bought.

price

string or number

The price of one unit.

currency

string

The currency of price.

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:

JavaScript
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.

JavaScript
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

  1. Go to Set up › Goals and click New Goal.
  2. Name it, for example "Purchase", and set Conversion type to Purchase.
  3. Set Count to Every time, so repeat orders by the same customer each count.
  4. Set Value tracking to Order value — it uses the amount of each order instead of a fixed value.
  5. Open Tracking, keep Event rules and choose the purchase event under Event. It appears in the list once the first order has arrived.
  6. 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

purchase

A checkout is completed.

initiate-checkout

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

  1. Place a test order.
  2. 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

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.

Was this article helpful?

Try it on your own site

Add a popup, form or quiz to your site in a few minutes and see what it does for your conversions.