> For the complete documentation index, see [llms.txt](https://docs.crobox.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.crobox.com/how-to-guides/analytics/metrics/create-a-metric.md).

# Create a metric

Create custom metrics, from simple counts to calculated rates, and manage the metrics in your container.

Default metrics cover the essentials, but your business questions are your own. Create a custom metric to track exactly what you need, then use it in any dashboard widget in your container.

## Before you begin

* You need edit rights to create, edit, or remove metrics.
* Metrics belong to a container. A metric you create is available to every dashboard in that container.
* Check whether a default metric already covers what you need. See [Default metrics](/how-to-guides/analytics/metrics.md#default-metrics).

{% stepper %}
{% step %}

#### Open the metric editor

Go to **Analytics** → **Metrics** and click **New metric**.
{% endstep %}

{% step %}

#### Name and format your metric

Under **General**, set:

* **Name** - The name you'll pick from when adding the metric to a widget. Describe what it measures, for example "Sessions with Finder completion."
* **Format** - How values are displayed: **Number**, **Currency** (uses your container's currency), or **Percentage**.
* **Decimals** - How many decimal places to show. The default is 2.

{% hint style="info" %}
**Percentage** multiplies the result by 100 for you. Build your metric as a ratio, like Transactions ÷ Sessions, and a value of 0.25 displays as 25.00%.
{% endhint %}
{% endstep %}

{% step %}

#### Choose a type

Under **Metric**, choose a **Type**:

* **Simple** - Counts or sums a single value, optionally filtered. For example, sessions that include an add to cart.
* **Calculated** - Combines other metrics with an operator. For example, Revenue ÷ Transactions.

Then follow the matching step below.
{% endstep %}

{% step %}

#### Build a Simple metric

**Metric Value** sets what you're measuring. The most common values are **Actions**, **Pageviews**, **Products**, **Promotions**, **Sessions**, **Transactions**, **Revenue**, **Revenue (cross session)**, **Transactions (cross session)**, and **Visitors**. Other reporting fields are also available.

**Aggregation Function** sets how values are combined:

| Function     | What it does                                                                 |
| ------------ | ---------------------------------------------------------------------------- |
| **Default**  | Uses the function that makes the most sense for the value, usually Distinct. |
| **Average**  | Calculates the mean of the values.                                           |
| **Sum**      | Adds up all values.                                                          |
| **Distinct** | Counts unique values.                                                        |
| **Min**      | Returns the smallest value.                                                  |
| **Max**      | Returns the largest value.                                                   |
| **Count**    | Counts every value, including repeats.                                       |

Leave it on **Default** unless you need a specific calculation.

**Filters** narrow down what's counted. Click **Condition** to add a single rule, or **Condition Group** to group several rules together.

* Conditions can use fields from Action, Chat, Date, Visitor, Message, Page, Product, Product Engagement, Product Finder, Promotion, Referrer, Region, Session, and User Agent. Property fields let you choose the property key.
* When you add a second item, choose **AND** or **OR** from the dropdown next to it. That choice applies to every item at the same level. Inside a group, the header shows whether **all** or **any** of the conditions must be true.
* Groups can be nested up to two levels deep.
* To exclude values, use a negative operator: **not equal to**, **not contains**, **not between**, or **is empty**.
  {% endstep %}

{% step %}

#### Build a Calculated metric

A Calculated metric combines operands, which can be Simple metrics or other Calculated metrics.

1. Choose an operator: **Plus**, **Minus**, **Divided by**, or **Multiplied by**. The operator applies to every operand in the block.
2. Configure each operand, and add more with the add button.
3. To control the order of operations, set an operand's **Type** to **Calculated**. It works like a pair of brackets.

For example, to calculate the share of carted products that weren't bought, (Product Carts − Product Boughts) ÷ Product Carts:

* Set the outer block to **Divided by**.
* Make the first operand a **Calculated** block set to **Minus**, with Product Carts and then Product Boughts.
* Make the second operand Product Carts.

{% hint style="warning" %}
Operands can't be reordered, so add them in the order you want them calculated. For Minus and Divided by, order matters: A − B isn't the same as B − A.
{% endhint %}
{% endstep %}

{% step %}

#### Save and check your metric

Click **Save**. Your metric appears in the Metrics list with its performance over the last three days. Use it as a quick sense check before adding the metric to a dashboard. For example, a rate above 100% usually means operands are in the wrong order.
{% endstep %}
{% endstepper %}

## Manage metrics

### Edit a metric

Click a metric in the list to open it, make your changes, and click **Save**. Changes apply straight away to every widget that uses the metric.

{% hint style="info" %}
To adjust a default metric, create a new metric instead of editing the default one. That keeps the default definitions consistent across your containers.
{% endhint %}

### Remove a metric

Open the menu (⋮) on the metric's row, click **Remove**, and confirm. Default metrics can't be removed.

{% hint style="warning" %}
Removing a metric doesn't update the widgets that use it, and there's no warning. Those widgets can no longer show data for the removed metric, so check your dashboards first.
{% endhint %}

### Copy metrics to another container

If you work across several containers, you can copy metrics between them instead of rebuilding them.

1. Select the metrics to copy with the checkboxes.
2. Open the menu next to **New metric** and click **Copy to clipboard**.
3. Switch to the other container, go to **Analytics** → **Metrics**, open the same menu, and click **Paste from clipboard**.

If a metric with the same name already exists, choose to **Skip** it, **Duplicate** it (it's added with "(copy)" in its name), or **Replace** the existing one. Use **Clear clipboard** when you're done.

## Frequently asked questions

<details>

<summary>Why does my percentage show a value above 100%?</summary>

Check the order of your operands. Operands are calculated in the order you added them, so a Minus or Divided by block with operands the wrong way round gives unexpected results. Also check that your metric produces a ratio, since the Percentage format already multiplies by 100.

</details>

<details>

<summary>Why doesn't the Formula column show my brackets?</summary>

The Formula column shows nested Calculated blocks without brackets, so (A − B) ÷ C displays as A − B ÷ C. Open the metric to see exactly how it's built.

</details>

<details>

<summary>Why is the performance value empty?</summary>

There's no matching data in the last three days. This is common for metrics based on page types or events your site doesn't track.

</details>

<details>

<summary>Can I use a custom metric in all my containers?</summary>

Metrics belong to one container. Use copy and paste to add the same metric to your other containers.

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.crobox.com/how-to-guides/analytics/metrics/create-a-metric.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
