# Configure goals

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

> Create a goal, link it to a page and assign it to an experiment.



A goal is defined once per project and can be used in any number of experiments. This page walks you through creating
a goal and assigning it to an experiment. The differences between the four goal types are explained in
[Goal types](https://docs.ablyft.com/guides/goals-and-measurement/goal-types/).

## Create a goal

1. Open your project and go to **Targeting & Goals → Goals**.
2. Click **Create your first goal**, or the create button above the goal list if you already have goals.
3. Fill in the form and save.

The form has four sections.

### General

| Field           | Description                                                                                           |
| --------------- | ----------------------------------------------------------------------------------------------------- |
| **Name**        | A clear name, for example `Add to cart click`. Required, up to 191 characters, unique in the project. |
| **Description** | Optional note about the purpose of the goal. It is shown on the results page.                         |

### Definition

Choose the **type** of the goal. The fields below change depending on your choice.

| Type         | What it counts                                            | Extra fields                                           |
| ------------ | --------------------------------------------------------- | ------------------------------------------------------ |
| **Pageview** | A pageview counts as a conversion.                        | **Page**                                               |
| **Click**    | A click on an element counts as a conversion.             | **Page**, **CSS selector**                             |
| **Custom**   | A conversion or a value that you trigger with JavaScript. | **API Name**, **Measurement type**                     |
| **Revenue**  | A revenue value that you trigger with JavaScript.         | **API Name**, **Currency sign**, **Value filter type** |

For **Custom** and **Revenue** goals, the form also shows an **API Code** box with the code to copy. Details are in
[Goal types](https://docs.ablyft.com/guides/goals-and-measurement/goal-types/).

### Statistic Settings

Set the **Counting method** and the **Winning direction**. Both are explained in
[Goal types](https://docs.ablyft.com/guides/goals-and-measurement/goal-types/#counting-method).

### Advanced Settings

| Field            | Description                                                                       |
| ---------------- | --------------------------------------------------------------------------------- |
| **Always embed** | If enabled, the goal is always embedded in the snippet. Not needed in most cases. |

## Link a goal to a page

Pageview and click goals are tied to a **page**. Select it in the **Page** field. You can only choose pages that already
exist in the project. Create them under **Targeting & Goals → Pages**, see [Pages](https://docs.ablyft.com/guides/audiences-and-delivery/pages/).

When exactly a pageview or click goal counts is described in
[Click & pageview goals](https://docs.ablyft.com/developers/tracking-and-events/click-and-pageview-goals/#how-pageview-goals-behave).

## Assign goals to an experiment

1. Open the experiment.
2. In the **Goals** section ("WHAT should be tracked?"), click **Select**.
3. In the **Select Goals** panel, click **Add existing goal** and choose a goal. Repeat for more goals.
4. Save. The notification **Goals updated** confirms the change.

In the same section, the link with the plus icon creates a new goal for the experiment. The goals are shown as badges
with the name and type, for example `Add to cart click [click]`.

## Primary and secondary goals

The order of the goals in the **Select Goals** panel matters:

* The **first goal is the primary goal**. The panel highlights it with a border.
* All other goals are secondary goals.
* The order is also the order of the goal cards on the results page.

The primary goal is your main success metric. ABlyft uses it for the project option **Auto-pause on significance**:
a running experiment is paused automatically as soon as its primary goal reaches statistical significance, and the team
is notified by email. You find this option under **Project → Settings → Statistics & Analytics**.

You can also define **Default Goals** under **Project → Settings**. They are added to every new experiment, and the
first default goal becomes the primary goal.

> **Goals added later:** If you add a goal to a running experiment, it is only counted from the day it was added. The results page shows the
> note "This goal was added later. It is counted from ..." for such goals.

## Edit, clone and delete goals

In the goal list, each row has an edit action and a menu with **Clone** and **Delete**. The list is grouped by type. You can
show more columns such as **API Name**, **Page** or **CSS selector**. The **Assigned** column shows in how many
experiments a goal is used. When you delete several goals at once, goals that are still used in an experiment are skipped.

## Next steps

* Choose the right type: [Goal types](https://docs.ablyft.com/guides/goals-and-measurement/goal-types/)
* Check that events arrive: [Verify measurement](https://docs.ablyft.com/guides/goals-and-measurement/verify-measurement/)
* Understand the numbers: [Metrics](https://docs.ablyft.com/guides/results/metrics/)

