# Goal types

URL: https://docs.ablyft.com/guides/goals-and-measurement/goal-types/

> Pageview, click, custom and revenue goals, and the settings that decide how they are counted.



When you [create a goal](https://docs.ablyft.com/guides/goals-and-measurement/configure-goals/), you first choose its type. The type decides
how ABlyft recognizes the event. Three more settings decide how the events are counted and evaluated: the counting
method, the winning direction and, for revenue goals, the value filter.

## Choose the type

| Type         | Use it when                                                                 | How it is triggered                                                             |
| ------------ | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| **Pageview** | Visiting a page is the success, for example a thank-you page.               | Automatically, when the linked page becomes active.                             |
| **Click**    | Clicking an element is the success, for example an "Add to cart" button.    | Automatically, when a visitor clicks an element that matches your CSS selector. |
| **Custom**   | Something else is the success, for example a form submit or a video played. | With a line of JavaScript on your website or in your tag manager.               |
| **Revenue**  | The success has a monetary value, for example an order.                     | With a line of JavaScript that passes the amount.                               |

## Pageview goals

A pageview goal counts a conversion when its **Page** becomes active for a visitor. Select the page in the **Page**
field; the page defines which URLs count (see [Pages](https://docs.ablyft.com/guides/audiences-and-delivery/pages/)). No code is needed
beyond the installed snippet.

## Click goals

A click goal counts a conversion when a visitor clicks an element that matches your **CSS selector**, on a page where
the goal's **Page** is active.

| Field            | Description                                                                                                |
| ---------------- | ---------------------------------------------------------------------------------------------------------- |
| **Page**         | The page on which clicks are tracked. Required.                                                            |
| **CSS selector** | Selector of the element, for example `.my-button`. Several selectors can be separated by commas. Required. |

How pageview goals and click goals behave in detail, and what to watch for with links to other pages, is described in
[Click & pageview goals](https://docs.ablyft.com/developers/tracking-and-events/click-and-pageview-goals/#how-pageview-goals-behave).

## Custom goals

A custom goal is triggered by your own code. In the **Definition** section you set:

| Field                | Description                                                                                                   |
| -------------------- | ------------------------------------------------------------------------------------------------------------- |
| **API Name**         | The name you use in your code. Letters, numbers, dashes and underscores. Unique in the project.               |
| **Measurement type** | **Conversion**: calculate based on conversion rate. **Value**: calculate based on a numeric value (metrical). |

The **API Code** box ("To track this event, add the following code to your page or tag manager.") shows the code
for your goal. Click it to copy. How to send the event is described in
[Custom goals](https://docs.ablyft.com/developers/tracking-and-events/custom-goals/#step-2-send-the-event-from-your-website).

## Revenue goals

A revenue goal measures money. Selecting **Revenue** sets the measurement type to value automatically.

| Field                  | Description                                                                   |
| ---------------------- | ----------------------------------------------------------------------------- |
| **API Name**           | The name you use in your code.                                                |
| **Currency sign**      | The sign shown next to revenue values in the results. Default: `€`. Required. |
| **Value filter type**  | **None**, **Absolute** or **Relative**. See [Value filters](#value-filters).  |
| **Value filter value** | Threshold of the filter. Required unless the filter type is **None**.         |

The **API Code** box generates the call with `eventType: 'revenue'` and an `eventValue` line. How to send the revenue is
described in [Revenue tracking](https://docs.ablyft.com/developers/tracking-and-events/revenue-tracking/#step-2-send-the-revenue).

> Shopify shops can send purchases to ABlyft by other means than this code, see [Shopify tracking](https://docs.ablyft.com/developers/tracking-and-events/shopify/).

## Counting method

The counting method decides what happens if the same visitor triggers a goal several times.

| Option    | Meaning                                         | Typical use                                                               |
| --------- | ----------------------------------------------- | ------------------------------------------------------------------------- |
| **One**   | One event per participant is counted (unique).  | "Did the visitor convert at all?" Newsletter sign-up, purchase as yes/no. |
| **Every** | Every event per participant is counted (total). | "How often?" Page views, add-to-cart clicks, orders per visitor.          |

With **One**, ABlyft sends the goal only once per participant and variation, even if your code calls it repeatedly. For
revenue goals, **Every** is usually what you want for revenue per visitor, while **One** only counts the first order.
With **One**, the number of conversions can never exceed the number of participants, so the conversion rate stays
between 0 and 100%. With **Every**, conversions can exceed participants and the conversion rate can be above 100%.

> With **One**, ABlyft remembers in the visitor's browser which variations already received the goal. If a visitor
> clears their browser storage, the goal can be counted again.

## Winning direction

| Option       | Meaning                                                                                            |
| ------------ | -------------------------------------------------------------------------------------------------- |
| **Increase** | More is better. A variation wins if the metric goes up.                                            |
| **Decrease** | Less is better. A variation wins if the metric goes down, for example for a bounce or error event. |

The direction decides whether a significant change is shown as a winner or a loser in the
[results](https://docs.ablyft.com/guides/results/interpret-results/).

## Value filters

Revenue goals can limit the influence of extreme values, such as one very large order, on the result. Values above the
limit are not removed; they are **capped** at the limit.

| Filter       | Limit                                                                                                                                        | Example                                          |
| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ |
| **None**     | No limit.                                                                                                                                    | Every value is used as it is.                    |
| **Absolute** | The number in **Value filter value** is the maximum value.                                                                                   | Value `500`: an order of 1,200 counts as 500.    |
| **Relative** | The limit is the average value plus the given percentage (`average + average / 100 × percentage`), calculated separately for each variation. | Average order 100, value `50`: the limit is 150. |

Use **Absolute** if you know a clear maximum that makes sense for your business. Use **Relative** if your data varies
and you want the limit to adapt; it does not compare against a fixed or global maximum.

### When to use a value filter

* A few transactions have a disproportionate influence on the result.
* Revenue values differ strongly between visitors.
* You want to evaluate typical visitor behavior instead of edge cases.

### What the filter changes

The filter affects the calculation and display of the results, for example the average revenue per visitor, the total
revenue and the uplift. It does not delete or overwrite any data, and it does not change tracking. You can change or
remove the filter at any time, the results are recalculated and you see the effect right away.

To set it, open the revenue goal of your experiment, choose the **Value filter type**, enter the **Value filter value**
and save the goal.

> Value filters change what the results show. Decide on a filter before you start the experiment, not after you have seen
> the numbers.

## Next steps

* [Verify measurement](https://docs.ablyft.com/guides/goals-and-measurement/verify-measurement/) before you start an experiment
* [Metrics](https://docs.ablyft.com/guides/results/metrics/): what conversions, value and improvement mean
* [Statistical methods](https://docs.ablyft.com/guides/results/statistics-methods/): how binary and value goals are evaluated

