SplitWisp

Docs

Pricing

Dashboard

Conversion Goals

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.

How It Works

  1. Configure goals in the dashboard when creating or editing an experiment
  2. Goals are delivered to the browser as part of the variant assignment response
  3. The SDK sets up listeners automatically after init() completes
  4. Conversions fire once per session — each goal is deduplicated so a visitor is only counted once per experiment, even if they trigger the goal multiple times

Goals work alongside the Visual Editor and code-based experiments. You can combine automatic goals with manual trackConversion() calls if needed.

Five Goal Types

1. Page Visit

Fires a conversion when a visitor reaches a specific URL. Supports glob patterns for flexible matching.

Config FieldDescriptionExample
urlPatternURL or path pattern to match/thank-you*, /checkout/success

Pattern matching rules:

  • * matches any characters (e.g. /products/* matches /products/shoes and /products/hats/red)
  • ? matches a single character
  • Path-only patterns (e.g. /thank-you) match against the URL pathname
  • Full URL patterns (e.g. https://example.com/thanks) match against the complete URL

SPA support: The SDK listens for popstate events, so page visit goals work with single-page applications that use the History API.

Example use cases:

  • Thank-you page after purchase: /checkout/thank-you*
  • Signup confirmation: /welcome
  • Pricing page visit: /pricing*

2. Element Click

Fires a conversion when a visitor clicks an element matching a CSS selector. Uses event delegation so it works with dynamically rendered elements.

Config FieldDescriptionExample
selectorCSS selector for the clickable element#buy-now, .cta-button, [data-action="signup"]

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:

  • CTA button click: .hero-cta
  • Add to cart: #add-to-cart
  • Navigation link: a[href="/pricing"]

3. Form Submit

Fires a conversion when a form matching a CSS selector is submitted.

Config FieldDescriptionExample
formSelectorCSS selector for the form element#signup-form, .contact-form, form[action="/subscribe"]

Example use cases:

  • Newsletter signup: #newsletter-form
  • Contact form: .contact-form
  • Search form: form[role="search"]

4. Scroll Depth

Fires a conversion when a visitor scrolls past a percentage threshold on the page.

Config FieldDescriptionExample
thresholdScroll percentage (0–100)75, 50, 90

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:

  • Read most of the article: threshold 75
  • Reached the pricing section: threshold 50
  • Scrolled to the bottom: threshold 95

5. Time on Page

Fires a conversion after a visitor has been on the page for a specified duration.

Config FieldDescriptionExample
durationMsTime in milliseconds30000 (30 seconds), 60000 (1 minute)

Example use cases:

  • Engaged reader (30 seconds): 30000
  • Deep engagement (2 minutes): 120000
  • Bounce prevention (10 seconds): 10000

Configuring Goals in the Dashboard

When Creating an Experiment

  1. Navigate to your project and click New Experiment
  2. Scroll to the Conversion Goals section
  3. Click Add Goal
  4. Enter a goal name (e.g. "Thank You Page", "CTA Click")
  5. Select the goal type from the dropdown
  6. Fill in the configuration field for that type (URL pattern, CSS selector, etc.)
  7. Add more goals as needed — there's no limit

When Editing an Experiment

Goals 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:

  • Pause the experiment, edit goals, then resume
  • Duplicate the experiment as a new draft with updated goals

Session Deduplication

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:

  • A visitor who clicks your CTA button 10 times is counted as 1 conversion
  • A visitor who visits the thank-you page, leaves, and comes back is counted as 1 conversion
  • Deduplication persists across SPA navigations within the same tab
  • A new browser session (new tab or cleared storage) starts with a clean slate

Combining Goals with Manual Tracking

You can use both automatic goals and manual trackConversion() calls on the same experiment. This is useful when you need:

  • Automatic goals for simple interactions (clicks, page visits)
  • Manual tracking for complex logic (e.g. tracking revenue value, conditional conversions)
// 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);
  });
});

Best Practices

  1. Use descriptive goal names — "CTA Click" and "Thank You Page" are clearer than "Goal 1" and "Goal 2"
  2. Test selectors before activating — use browser DevTools to verify your CSS selectors match the right elements
  3. Prefer specific selectors#buy-now is more reliable than .btn which might match multiple buttons
  4. Set realistic scroll thresholds — 75% is a good default for "read the page"; 95%+ can be unreliable on pages with variable-height footers
  5. Combine goal types — use a page visit goal for the thank-you page AND a click goal for the CTA to understand the full funnel

Viewing Goal Results

Conversion goal events appear in the experiment's results alongside manual conversion events. In the dashboard:

  • Total Conversions includes both automatic goal-triggered and manual conversions
  • Conversion Rate is computed from all conversion events
  • Goal metadata (goal name, type, and ID) is attached to each conversion event as properties

For more on interpreting results, see Understanding A/B Test Results.

What's Next?