Trigger Goals

For any campaign, we want to track conversion changes for the A/B test.

We can define goals in the VWO web portal during the campaign setup.

test_goal

Whenever a user completes the action which we want to optimize, we can trigger a goal.

VWO.trackConversion("test_goal");
VWO.trackConversion("test_goal")

If you trigger the above code multiple times, the SDK takes care to count the conversions only once per user.

Type of goals

  • Triggers custom conversion
    The custom conversion goal is used for generic events when we want to record an event for a conversion. The above example was for this goal type.

  • Generates Revenue
    This goal is useful when we want to track a revenue value using the conversion event.
    For example, if we are testing the purchase button, we would want to track the item value.
    Here is the code sample for generating the revenue goal:

VWO.trackConversion("test_goal", 100.0);
VWO.trackConversion("test_goal", 100.0)

πŸ“˜

Note

Your code can trigger a goal multiple times for a user, but the SDK makes sure that a conversion is counted only once per user.
This is done to avoid multiple instances of counting the same goal and to keep the campaign results consistent.