Conversion goals let you track user actions automatically — without writing any tracking code. Configure goals when creating an experiment, and the SplitWisp SDK handles the rest.
init() completesGoals work alongside the Visual Editor and code-based experiments. You can combine automatic goals with manual trackConversion() calls if needed.
Fires a conversion when a visitor reaches a specific URL. Supports glob patterns for flexible matching.
Pattern matching rules:
* matches any characters (e.g. /products/* matches /products/shoes and /products/hats/red)? matches a single character/thank-you) match against the URL pathnamehttps://example.com/thanks) match against the complete URLSPA support: The SDK listens for popstate events, so page visit goals work with single-page applications that use the History API.
Example use cases:
/checkout/thank-you*/welcome/pricing*Fires a conversion when a visitor clicks an element matching a CSS selector. Uses event delegation so it works with dynamically rendered elements.
The SDK uses Element.closest() for matching, so clicks on child elements (e.g. an icon inside a button) are correctly captured.
Example use cases:
.hero-cta#add-to-carta[href="/pricing"]Fires a conversion when a form matching a CSS selector is submitted.
Example use cases:
#newsletter-form.contact-formform[role="search"]Fires a conversion when a visitor scrolls past a percentage threshold on the page.
The SDK checks the scroll position immediately (in case the page is already scrolled) and then listens for scroll events using a passive listener for performance.
Example use cases:
755095Fires a conversion after a visitor has been on the page for a specified duration.
Example use cases:
3000012000010000Goals can be edited on draft and paused experiments. They are locked on active and completed experiments to preserve data integrity. See Experiment Lifecycle for details on status rules.
To edit goals on a running experiment, either:
Each goal fires at most once per session per experiment. The SDK tracks fired goals in sessionStorage using a set of experimentId:goalId keys. This means:
You can use both automatic goals and manual trackConversion() calls on the same experiment. This is useful when you need:
// Automatic goal: tracks "CTA Click" when .buy-now is clicked (configured in dashboard)
// Manual: tracks revenue on successful checkout
SplitWisp.init({
apiKey: 'YOUR_API_KEY',
endpoint: 'https://api.splitwisp.com',
}).then(function (tracker) {
// Automatic goals are already running.
// Add manual tracking for purchase value:
document.querySelector('#checkout-form').addEventListener('submit', function () {
var amount = getCartTotal(); // your custom logic
tracker.trackConversion('exp_checkout_flow', amount);
});
});
#buy-now is more reliable than .btn which might match multiple buttonsConversion goal events appear in the experiment's results alongside manual conversion events. In the dashboard:
For more on interpreting results, see Understanding A/B Test Results.
trackConversion() API and the ConversionGoal type definition