Setting Up Goals
Goals define what success looks like for your experiments. Every experiment needs at least one goal to measure — it's how Apex determines which variant wins.
Goal Types
Apex supports four goal types, each tracking a different kind of user action:
| Type | Trigger | Best For |
|---|---|---|
| Form Submit | Visitor submits a specific form | Lead generation, signups, contact forms |
| Click | Visitor clicks a specific element | CTA buttons, pricing plan selection, navigation |
| Pageview | Visitor reaches a specific URL | Thank-you pages, checkout confirmation, onboarding completion |
| Custom Event | Your code fires a specific event | Purchase, video play, feature activation, any custom action |
Creating a Goal
Navigate to Goals
Go to Goals in the dashboard sidebar and click New Goal.
Choose the goal type
Select one of the four types above. The configuration form changes based on your selection.
Configure the trigger
Form Submit: Enter a CSS selector that identifies the form (e.g. #signup-form or form[data-form="contact"]). The tracking snippet intercepts form submissions matching this selector.
Click: Enter a CSS selector for the clickable element (e.g. .cta-button or #pricing-start). Apex tracks clicks on matching elements.
Pageview: Enter the URL path that counts as a conversion (e.g. /thank-you or /onboarding/complete). Supports exact match or prefix match.
Custom Event: Enter the event name that your code sends via apex.track() or the SDK's track() function (e.g. purchase_completed or trial_started).
Name your goal
Give it a clear, descriptive name. This appears in experiment results and the dashboard. Good: "Pricing page signup form submit." Bad: "Goal 1."
Save
Click Save. The goal is now available to link to experiments.
Connecting Goals to Experiments
When creating an experiment, you select a goal as the success metric. Apex tracks how many visitors in each variant trigger the goal and calculates conversion rates accordingly.
Info
Each experiment has one primary goal that determines the winner. You can track secondary metrics for additional insight, but the primary goal is what drives the statistical analysis.
Goal Type Details
Form Submit
The tracking snippet automatically monitors all <form> elements on your page, plus "formless" regions (groups of inputs with a submit button but no <form> wrapper, common in React and Plasmic sites). When a form is submitted, it counts as a conversion. For native <form> elements, the snippet also injects hidden attribution fields.
<!-- Native form — tracked automatically -->
<form id="signup-form" action="/api/signup" method="POST">
<input type="email" name="email" />
<button type="submit">Sign Up</button>
</form>
<!-- Formless region — also tracked automatically -->
<div class="contact-section">
<input type="text" name="name" />
<input type="email" name="email" />
<button>Submit</button>
</div>
See Form Tracking for details on how formless detection works and manual tracking options.
Click
Click goals track interactions with specific page elements. The selector should be specific enough to match only the element you care about.
Apex provides three ways to select the element:
- Visual picker (iframe preview) — Apex loads a preview of your page and lets you click the element directly. Works on most static and server-rendered sites.
- Live site picker — If the preview can't render your site (common with React, Next.js, or Plasmic), Apex opens your actual live site in a new tab. The Apex snippet activates a picker overlay — click an element and the selector is sent back to the dashboard automatically.
- Bookmarklet — If the Apex snippet isn't installed yet, drag the "Apex Picker" bookmarklet to your bookmarks bar and click it on your site to pick an element.
- Manual selector — Enter a CSS selector directly if you know it (e.g.,
#cta-buttonor.pricing-signup).
Tip
Use an id selector when possible (#cta-button) for precision. Class selectors (.btn-primary) may match multiple elements — which is fine if you want to track any of them.
Pageview
Pageview goals fire when a visitor navigates to a specific URL. This works well for funnel tracking — if your signup flow ends at /welcome, a pageview goal on that URL captures everyone who completes the flow.
Custom Event
Custom event goals give you full flexibility. Send any event from your code and use its name as the goal trigger:
// Using the tracking snippet
window.apex.track("trial_started", { plan: "pro" });
// Using the SDK
import { track } from "@apex-inc/sdk";
track("trial_started", { plan: "pro" });
Best Practices
- One goal per experiment. Multiple goals dilute statistical power. Pick the one metric that matters most.
- Use form submit for lead gen. It's the most reliable trigger since the snippet handles it automatically.
- Test your goal before launching. Open the page, trigger the action, and verify the event appears in the dashboard's event stream.
- Name goals descriptively. You'll reference them across multiple experiments — clear names save confusion later.
Next Steps
- Run an experiment using your new goal
- Learn about the tracking snippet and how it captures events
- Send custom events for advanced goal tracking