This website works best with JavaScript enabled. Learn how to enable JavaScript.

Implement Revenue Goal for Testing

Last updated

Revenue goal allows you to track revenue from purchases and other transactions on your website by attributing the revenue amount for every valid and successful transaction. After you set up the revenue goal, VWO generates a revenue tracking code that you can add to your website, usually on the purchase confirmation page.

Using VWO, you can create two types of revenue codes – one as part of your A/B and Split Tests (including MVT, personalization), and the other to track revenue data for research. The revenue code generated for each type is different. Please make sure to use the appropriate code. This article explains the setup process and code for revenue tracking for tests. To learn how to setup revenue tracking for research, click here.

Follow these steps to track revenue generation for a test:

  1. Create an A/B, Split URL or Multivariate test.
  2. On Define Conversion Goals page, select track revenue on and type the URL of the goal page where you will have access to the revenue amount of each successful transaction. It is typically available on the thank you page after a successful payment/transaction. 
  3. On that ‘thank you’ page, copy and paste the following revenue code and pass the value equal to the total revenue generated by the visitor. Consider that a visitor purchased two items, one for $15 and the other for $7. Now, enter the output value as 22 in the variable. If the visitor bought only one item (for $10), enter the output value as 10. You don’t need to be concerned about which variation the visitor saw or what individual items did the visitor buy. You just need to output the total revenue and VWO will take care of the rest.Consider another example: If the page where we redirect after successful plan purchase is, then all we need to do is to copy-paste default VWO code there and also output following code:
    <script type="text/javascript">
    window._vis_opt_queue = window._vis_opt_queue || [];
    window._vis_opt_queue.push(function() {_vis_opt_revenue_conversion("REPLACE_THIS_WITH_ACTUAL_REVENUE");});

Note: If the revenue value is added as comma separated value without decimals, VWO by default replaces the comma (,) with a decimal. For example, if you enter the value as 1,500, the comma is replaced with decimal as 1.5. Please make sure to add the revenue value without the comma (,) such as 1500 or 1500.0.

Add Multiple Revenue Goals on a Single Page

By default, VWO allows creating one revenue tracking goal for each test. However, to track multiple revenue goals on a single page, such as a thank you or confirmation page, follow these steps to create a queue functionality:

  • Remove var _vis_opt_revenue = “REPLACE THIS WITH ACTUAL VALUE”; from the code in the test pages.
  • Use the queue functionality to trigger conversions for the two revenue goals so that you can add the code.

This is how the revenue tracking code snippet looks like:

<script type="text/javascript">

var rev1= <revenue for 1 st revenue tracking goal>;

var rev2 = <revenue for 2nd revenue tracking goal>;

window._vis_opt_queue = window._vis_opt_queue || [];


function() {_vis_opt_register_conversion(<goal ID1>, <Campaign ID>, rev1);});

window._vis_opt_queue.push(function() {_vis_opt_register_conversion(<goal ID2>, <Campaign ID>, rev2);});


Replace the respective revenue variable with the respective goal ID in the goal URL. As soon as the visitor visits the goal URL on which the revenue code is present after the VWO code, a conversion will be triggered in VWO, and the revenue value will be logged for the corresponding goal ID.

Locate your Goal ID in VWO

To locate your goal ID:


  1. Select the test for which you want to locate the goal ID.
  2. Next, select the Settings tab and click on Goal option.
  3. The Goal page will display all goals you have created for the test with a Goal ID assigned to each goal created.

VWO only tracks unique conversions, which implies that VWO will show the value of the first purchase of the unique visitor under the revenue goal.

If you need information regarding how much was the total sales made for a specific test, you can integrate the reports with your GA/UA account and then compare the data shown in VWO – unique conversions, vs in GA, total sales made by the visitor who became a part of the test.

Was this article helpful?

Thanks for your feedback!
Please email us at to tell us what you were looking for. We'll send the answer to your inbox.

Contact Us / Login