Revenue tracking Goal
To track revenue, you’ll need to add a small snippet of code to your site, usually on the purchase confirmation page.
The required custom event that calls our revenue tracking API is:
<script>
window.optimizely = window.optimizely || [];
window.optimizely.push(['trackEvent', 'eventName', {'revenue': valueInCents}]);
</script>
'eventName' - This parameter is required, and you may choose the value that goes there. If, for example, you wanted to track the event and name it ‘purchases’, you would put ‘purchases’ in place of ‘eventName’.
In addition to tracking revenue (in cents), you can also report the purchase event as a conversion by creating a custom event goal. To track conversions, simply add a custom event goal for ‘purchases’ (or whatever value you have given your ‘eventName’) on the Results page. You do not have to add this goal for the revenue goal to track.
valueInCents - This is the numerical representation of the purchase amount in cents (purchase amount*100). It is crucial that you pass this value to Optimizely in cents, otherwise your revenue totals will be incorrect.
If you do not use U.S. currency (cents), simply multiply the purchase amount in your currency by 100. For example, a purchase amount of €54.99 should be passed as 5499.
REMOVE OUTLIERS
Abnormally large orders can substantially affect or misrepresent your average revenue per customer. We recommend filtering out outliers (purchases that far exceed your Average Order Value) from your revenue tracking code, so they don't distort your experiment results.
The revenue distribution view on the Results page can help you spot outliers. Click Distribution in the revenue distribution chart to view the share of conversions by revenue amount.
ou'll need to determine what amount is considered an outlier, then modify your code based on that amount. Here's an example using $100 as the threshold (marked here as 10000, because it's the amount in cents):
if(priceInCents < 10000){
window.optimizely = window.optimizely || [];
window.optimizely.push(['trackEvent',
'orderComplete', {'revenue': priceInCents}]);
}