- Optimizely Web Experimentation
Optimizely Web Experimentation can track total revenue from purchases or other events on your site and attribute the amount to a specific experiment and variation. When you add the required code to your site (usually on the purchase confirmation page) and add the revenue metric to your experiment, you can see the revenue earned per visitor, revenue per paying visitor, purchases, and the total revenue earned per variation on the Optimizely Experimentation Results page.
Revenue should not be your primary metric because, unlike clicks or pageviews, revenue does not measure a specific, discrete action your visitors take. However, tracking revenue connects your optimization efforts to the metrics your company values most.
Things to know
- The Optimizely Web Experimentation snippet must be present on the page where you are tracking revenue.
- The
valueInCents
variable is tracked in cents, so $54.99 should be recorded as 54.99 x 100 = 5,499. - If your site accepts multiple currencies, convert all currencies to a single denomination before converting the
valueInCents
variable.
Implement the Optimizely Web Experimentation revenue tracking code
To track revenue, you must add a small code snippet to your site to call Optimizely Web Experimentation's revenue tracking API. This code (an example of a custom event) typically goes on the purchase confirmation page, and it should look like the following:
<script> window["optimizely"] = window["optimizely"] || []; window["optimizely"].push({ "type" : "event", "eventName" : "trackRevenue", "tags" : { "revenue": valueInCents } }); </script>
The 'eventName'
parameter is required. You can name it what you want. For example, if you want to track the event and name it 'purchases'
, type 'purchases'
in place of 'trackRevenue'
in the previous code block.
The valueInCents
variable represents the purchase amount, in cents (purchase amount*100). This value must be passed to Optimizely Web Experimentation in cents. Otherwise, your revenue totals are incorrect. If you do not use United States currency, multiply the purchase amount in your currency by 100. For example, a purchase amount of €54.99 should be passed as 5499.
//pass the total purchase amount to a variable var value = ‘youDefineThisValue’; // Revenue must be added in cents var valueInCents = value * 100;
You can choose which currency symbol is displayed for revenue metrics on the Optimizely Experimentation Results page.
Best practices
- Track revenue after your checkout or billing detail form is submitted to avoid sending revenue totals for invalid purchases to Optimizely Web Experimentation.
- Avoid triggering the revenue goal at the click of a button. Due to validation errors, a visitor may click the button several times, and the revenue total would be sent to Optimizely Web Experimentation on each click.
- Pass the value to Optimizely Web Experimentation as an integer. Otherwise, your revenue totals are not sent to Optimizely Web Experimentation and do not display on the Optimizely Experimentation Results page. If your site's revenue calculation code returns a floating-point value such as 99.99999999999, you should truncate or round that value to 99.99 or 100. Choose a method that works best for your business needs.
Along with tracking revenue, you can report the purchase event as a conversion by creating a custom event. Add a custom event for 'purchases'
(or the value for your 'eventName'
) on the Optimizely Experimentation Results page to track conversions. You do not have to add this event to track revenue.
'revenue'
tag assigned to it, regardless of the event name or which project or Optimizely Experimentation product (Web Experimentation or Feature Experimentation) the event tracking is instrumented in.When you implement this code on your page, you do not need to adjust it again. The same code can be reused to track revenue for multiple experiments across the project.
Unlike most other metrics, the revenue metric is cumulative and is not de-duplicated based on the visitor’s unique user ID or another identifier like order ID. As such, revenue is counted toward the variation total each time Optimizely Web Experimentation receives a revenue amount.
To more accurately count how many transactions were received by Optimizely Web Experimentation, add a page view event to the confirmation or thank you page where the revenue API call is located. When this metric is set to count 'total conversions', you should have a better representation of how many times the revenue event was triggered or how many total transactions were made.
Add the Overall Revenue metric to your experiment
Add the Overall Revenue metric to your experiment to let Optimizely Web Experimentation know that you want to track revenue for this experiment. Overall Revenue does not count conversions with $0 or negative values. To track discount values, returns, credits, other negative revenue, or $0, use a custom revenue event to track conversions.
Overall revenue is not an event. No conversion in the Experimentation Events Export data has the name overall revenue. There is no event API name or ID. Instead, overall revenue is a special calculation Optimizely does on the Optimizely Experimentation Results page based on events generated by visitors bucketed in the experiment.
See Configure multiple revenue tracking events if you have multiple revenue streams.
Without metrics hub
-
Go to Optimizations and select or create an experiment.
- Click Metrics.
- Click Overall Revenue. Overall revenue becomes your primary metric for this experiment. You can add other metrics as needed and select a different one to be the primary.
- Choose to measure the Increase or Decrease of revenue for visitors or conversions.
-
Click Save to Experiment.
-
Click Save to save your metrics for this experiment, or click Revert to cancel your changes.
With metrics hub
To create a one-time bounce rate or exit rate metric, complete the following:
- Go to Optimizations and select or create your experiment.
- Click Metrics.
- Click Browse and select Create one-time metric.
- Select Overall Revenue from the Metric Type drop-down list.
- (Optional) Enter a Name. If you do not enter a name, Web Experimentation creates one automatically.
- (Optional) Enter a Description.
- Leave Overall Revenue as the Event.
- Choose to measure the Increase or Decrease of revenue for visitors or conversions.
- Click Save on the Create one-time Metric page.
- Click Save on the Metrics page.
To create a reusable revenue metric, complete the following:
- Click Metrics to access metrics hub.
- Click Create New Metric.
- Select Overall Revenue from the Metric Type drop-down list.
- (Optional) Enter a Name. If you do not enter a name, Web Experimentation creates one automatically.
Cross-project metrics must be unique. See the Metric creation requirement section of the Metrics hub documentation for information.
- (Optional) Enter a Description.
- Leave Overall Revenue as the Event.
- Choose to measure the Increase or Decrease of revenue for visitors or conversions.
- (Optional) Select Cross-project metric to make the metric available across your Experimentation projects.
- Click Save.
Outlier smoothing
Abnormally large orders can substantially affect or misrepresent your average revenue per customer. You should keep Enable outlier smoothing checked for revenue metrics so that outliers do not distort your experiment results. See how Optimizely Web Experimentation handles outliers for information.
Please sign in to leave a comment.