Skip to main content

Adding revenue

To track revenue data in your experiments, you need to implement a revenue callback on your success page. For e-commerce sites, this is typically the “thank-you” or order confirmation page — the page that verifies the purchase and includes details such as the order ID, total order value, and item quantity.

<script>
Lyftio.revenue.push({ orderId: "abc123", totalValue: 12345.9, itemQty: 2 });
</script>

To really be sure that the Lyftio script has loaded and is ready to receicve the revenue callback please use the following code block

<script>
if (window.Lyftio && Lyftio.revenue) {
Lyftio.revenue.push({ orderId: "abc123", orderValue: 12345.9, itemQty: 2 });
} else {
window.addEventListener("Lyftio::Started", (e) => {
Lyftio.revenue.push({ orderId: "abc123", orderValue: 12345.9, itemQty: 2 });
});
}
</script>
note

Lyftio does not handle currency conversions. The order values need to be convered into one and the same currency before the push.

tip

If you do not have access to a currency converter you can use a static currency excange chart to make all your orders into the same currency.

warning

The populated values needs to be of the correct data type for the revenue callback to be accepted;

  • orderId: string
  • totalValue: number (use dot (.) for decimals)
  • itemQty: number