All docs pages
Goals#
A goal defines what counts as a conversion: a click, a visit to a page, a form, a purchase. Every experiment has one primary goal, which decides the verdict, and can have secondary goals and guardrails. Goals belong to the project and can be reused by any of its experiments.
Goal types#
type |
Fires when | Needs |
|---|---|---|
click |
A visitor clicks an element matching selector (also a click on something inside it). |
selector, optionally a url_rule to limit it to some pages |
pageview |
A visitor views a page matching url_rule. |
url_rule (same format as page rules) |
form_submit |
A visitor submits a form matching selector. |
selector |
custom |
Your code calls tryfast.track(key). |
the tracking code below |
engagement |
A visitor views a second page or clicks anything, once per visit. | nothing |
Click, page view, form and engagement goals work without code: they are part of your project's script and fire site-wide for every consenting visitor.
Custom goals and revenue#
Add the tracking call where the conversion happens, for example on your order confirmation:
window.tryfast = window.tryfast || [];
window.tryfast.push(["track", "purchase", { revenue: 79.90, currency: "EUR", orderId: "A-10442" }]);
The app and create_goal show this code for every custom goal. Rules:
- Order ids de-duplicate: a second conversion with the same
orderIdfor the same goal within 90 days is ignored, so reloads of a thank-you page never count twice. - Currency: each project has one currency (default EUR, set in the project settings). Revenue in another currency is stored, left out of revenue results and reported as a warning.
- Revenue must be 0 or more; negative values (refunds) are dropped.
- Revenue cap (
revenue_cap): an optional maximum per visitor, so one unusually large order cannot decide a test. The cap is fixed per experiment when it launches.
Metrics#
metric |
Measures | Shown as |
|---|---|---|
conversion (default) |
The share of visitors who converted at least once. | Conversion rate |
count |
Conversions per visitor. | Conversions per visitor |
revenue |
Revenue per visitor (custom goals only). | Revenue per visitor |
higher_is_better (default true) tells the statistics which direction is good; set it to false for goals such as "Opened the returns page".
Keys#
Every goal has a key, the event key it counts (purchase, started_checkout): letters, digits, _, ., : and -, up to 64 characters, unique in the project and case-sensitive. It defaults to a slug of the name. A key cannot change once the goal has conversions.
Calls to tryfast.track() with a key that has no goal yet are kept (up to 500 distinct keys per project) and listed under Events without a goal and by get_events. So you can add the tracking code first, watch the event arrive, and define the goal afterwards.
Roles in an experiment#
- Primary goal (exactly one): decides the verdict and the recommendation.
- Secondary goals: reported with their own results, adjusted for testing several goals at once. They never decide the verdict.
- Guardrails: goals that must not get worse, such as "Returned an order" or revenue. If a variation makes a guardrail significantly worse, the verdict becomes "Stop now" and recommends keeping the control.
You can add secondary goals and guardrails to a running experiment, and they count retroactively from its start: TryFast records conversions by event key for every visitor in the experiment.
When conversions count#
A conversion counts for an experiment when:
- the visitor was assigned to a variation of the experiment before the conversion happened,
- the experiment was running at that moment (conversions while it is paused do not count), and
- it arrived from one of the project's domains, and from a visitor who consented (with the default consent mode).
Each visitor is counted in the variation they were first assigned to, from that moment until the experiment stops, even if they later see the page without the change.
Editing rules#
While a goal is used by a scheduled, running, paused or shipped experiment, only its name can change; changing its selector, page rule, type, metric or direction, or archiving it, answers 409 conflict (goal_in_use). Create a new goal and attach it instead. A goal used by any experiment that is not archived cannot be deleted.
Limits#
100 active goals per project, 20 goals per experiment, 10 properties per track call.
API and agents#
GET and POST /api/v1/projects/{project_id}/goals, GET, PATCH and DELETE /api/v1/goals/{goal_id}, recent events at GET /api/v1/projects/{project_id}/events. Agents use list_goals, create_goal, update_goal and get_events. In the visual editor, Use as click goal creates a click goal from the selected element.