Goals
Goals define what success means for an experiment. They turn exposures into measurable conversion rates.
What are goals?
Section titled “What are goals?”A goal is a conversion criterion attached to an experiment. When a visitor with an active assignment meets the goal condition, Ttoolab records a conversion for that visitor’s variant.
Each experiment can have multiple goals. One goal is typically marked as the primary goal for reporting.
Goal types
Section titled “Goal types”| Type | Trigger |
| :--- | :------ |
| page_view | Visitor reaches a URL matching a pattern |
| click | Visitor clicks a CSS selector |
| custom_event | Visitor triggers a ttoolab.track() event with a matching name |
| revenue | Custom event includes a revenue value in the payload |
| form_submit | Visitor submits a form matching a selector |
How goals measure experiments
Section titled “How goals measure experiments”Conversion rate = conversions / exposures- Exposures are counted automatically when a visitor is assigned (
$exposureevent). - Conversions are counted when a goal condition is met after assignment.
Results are broken down per variant in the dashboard.
Custom events as goals
Section titled “Custom events as goals”The most flexible approach is a custom_event goal:
- Create a goal with event name
purchase. - Send the event from your checkout code:
window.ttoolab?.track("purchase", { revenue: 99.90, currency: "USD"});- Ttoolab attributes the conversion to the visitor’s assigned variant.
E-commerce goal examples
Section titled “E-commerce goal examples”| Goal | Type | Configuration |
| :--- | :--- | :------------ |
| Order completed | custom_event | Event name: purchase |
| Cart add | custom_event | Event name: add_to_cart |
| Revenue per order | revenue | Event name: purchase (with revenue in payload) |
| Thank-you page | page_view | URL contains /order-confirmation |
| Checkout CTA click | click | Selector: #checkout-button |
Revenue goals
Section titled “Revenue goals”Include a numeric revenue field in the event payload:
window.ttoolab?.track("purchase", { revenue: 249.00, order_id: "ORD-12345"});Revenue is aggregated per variant in daily stats.
Primary goal
Section titled “Primary goal”Set a primary goal when creating the experiment. The dashboard highlights this goal in results summaries and winner detection.
Webhook event experiment.winner_detected may fire when a statistically significant winner is found.
Best practices
Section titled “Best practices”- Define goals before launching — changing goals mid-experiment affects comparability.
- Prefer
custom_eventgoals for reliable tracking across SPAs. - Use revenue goals when comparing average order value, not just conversion rate.
- Align goal names with your analytics taxonomy (GA4, internal BI).