How to create a Custom Conversion Goal?

1. First you need to create a Custom Conversion goal when setting up your goals (or within the “View / Edit Test Details” tab in your dashboard).

2. Go to the code snippets tab in VWO and there you will find the custom conversion code below the VWO code. Custom conversion code snippet is specific to each goal.

3. You will get a code snippet similar to the one mentioned below:

4. In order to make a custom conversion goal work, you need to make sure this snippet of code is executed whenever you wish to fire the conversion. It can be on a button click, link click, success of Ajax request etc.

5. Following is the working example of a custom conversion goals bound to the onclick event of an anchor tag.

6. In the example above, the code snippet is bound to the onclick event of the anchor tag, it means, if anyone clicks on the anchor tag, conversion would be fired.Certain precautions while using Custom Conversion goal:

1. In case you are using custom conversion code on your page such that it may get executed even before VWO code loads on the page, you must use queue functionality in VWO. Below is an example of how you can use queue functionality to make sure custom conversion gets fired only after the VWO code loads.

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);});

2. In case you need to use the same custom conversion goal in multiple tests, you must select the goal from frequently used goals list available inside VWO. You will see this list when you are editing/adding goals in VWO(shown below in the image).