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

How to Implement a Custom Conversion Goal 

Last updated

By using VWO, you can create goals to track custom conversions that will trigger the JavaScript code snippet when the goal condition is fulfilled. When you create a custom goal, VWO generates a smart code snippet that you can add to your test pages to track conversions. A custom conversion goal is defined typically to track goals that are not directly related to clicks or URLs.

For example, consider that your website displays a pop-up window at certain instances of a flow (say, while making a purchase). The pop-up window is outside the page URL, so VWO default goals cannot track the events on the pop-up window. To track events on this window, you can create a custom conversion goal by triggering a JavaScript code on the page URL.

You can create custom conversion goals in two ways by using VWO:

  • Standalone Goals: Goals that are not part of a test, but actively running on your websites. For example, you may only want to check how the Subscribe Us CTA is performing, without having to create the entire test.
  • Test Goals: Custom goals that you create for a test. Test goals are specific to the experiment you are running. For example, you may be creating an AB test to check if any change in the color and size of the Check Out button records more conversions.

Creating Standalone Custom Goals

  1. Sign in to the VWO admin dashboard.
  2. From the left menu, under Track, click Goals.
  3. To begin the goal creation process, click Create.
  4. From the Select goal to track drop-down, select the Custom Conversion goal type. To learn about the different goal options, click here.
  5. Type the URL of the page where you want to track custom conversion, and then click Next.
  6. Select a URL or pattern of your website pages where your visitors land and can potentially take the action you have defined for goal conversion.
  7. To complete the goal creation process and start the goal, click Next.  At the last step of the goal, VWO will provide the JavaScript code snippet you can add to your website for tracking conversions.

Creating Custom Conversion Goals for a Test

Follow these steps to create a custom conversion goal for a test:

  1. On the Conversion Goals page, select the tracks custom conversion on option from the Goal1 drop-down list.custom-goals-1
  2. Select the appropriate URL type; and then enter the URL, pattern, or regular expression of the page where you want to track the conversion.
  3. Click Next, and then complete the remaining test configurations.
  4. On the final Code Checker Status page, go to the end of the page where you will find the following custom conversion code snippet:
    <script type="text/javascript">window._vis_opt_queue = window._vis_opt_queue || [];window._vis_opt_queue.push(function() {_vis_opt_goal_conversion(204);});</script>
    Note: The custom conversion code is unique to each custom goal you define for a test.
  5. To make a custom conversion goal work, execute this code snippet whenever you wish to fire the conversion. It can be on a button click, link click, success of Ajax request, and so on. For example, to trigger a custom conversion goal bound to a click event of an anchor tag, specify the code as follows:
    <a onclick="window._vis_opt_queue=window._vis_opt_queue||[];window._vis_opt_queue.push(function(){_vis_opt_goal_conversion(200)});" href="#"> <span>Sign Up</span> </a>
    In this example, the code snippet is bound to the on-click event of the anchor tag. Click the anchor tag to fire the conversion.
  6. To reuse a custom conversion goal across multiple tests, select the goal from your Frequently Used Goals section.

Best Practices

Always use the queue functionality to ensure that your custom conversion goal gets fired after VWO Smart Code. The following snippet is an example of how to use the queue functionality:

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

//Do change the Goal ID below (currently shown as 200) to the one shown in the code snippet tab of the test.

window._vis_opt_queue.push(function() {_vis_opt_goal_conversion(200);

Was this article helpful?

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

Contact Us / Login