Adding revenue
Step 1 - add the callback
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.
To really make sure that the Lyftio script has loaded and is ready to receive the revenue callback please use the following code block
<script>
if (window.Lyftio && Lyftio.revenue) {
Lyftio.revenue.push({ orderId: "abc123", totalValue: 12345.9, itemQty: 2 });
} else {
window.addEventListener("Lyftio::Started", (e) => {
Lyftio.revenue.push({ orderId: "abc123", totalValue: 12345.9, itemQty: 2 });
});
}
</script>
Lyftio does not handle currency conversions. The order values need to be convered into one and the same currency before the push.
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.
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
Step 2 - add a revenue goal in your experiment
To track revenue for an experiment, add a goal with a single revenue condition.
The goal will appear as a standard conversion goal in Overview but will also enable the Revenue tab. The Revenue tab displays monetary results and the calculated probability of a revenue increase.