> ## Documentation Index
> Fetch the complete documentation index at: https://dev.docs.inworld.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Custom Metrics

> Define KPI metrics from your imported events to measure routing impact

Once you've [imported events](/router/data-integrations/overview) from your analytics platform, you can create custom metrics in Portal. These metrics aggregate your imported events and can be associated with routers — letting you see how different routes and variants affect your business KPIs.

## Prerequisites

Before creating a custom metric, you need:

* At least one integration ([Mixpanel](/router/data-integrations/mixpanel) or [BigQuery](/router/data-integrations/bigquery)) with **import enabled**
* At least one **event configured** for import in that integration

## Creating a metric

<Steps titleSize="h3">
  <Step title="Open the New Metric dialog">
    In [Portal](https://portal.inworld.ai), go to **Routers** and click **Set Up Metrics** to open the **Data Integrations** page, then click **New Metric**.
  </Step>

  <Step title="Name your metric">
    Enter a **name** for the metric (e.g., "Onboarding completion rate") and an optional **description** explaining what it measures. The name becomes the metric's identifier and cannot be changed after creation.
  </Step>

  <Step title="Select an event">
    Choose the imported event this metric should track. Events are listed from all integrations that have import enabled — each event shows its source platform icon so you can identify which integration it comes from.
  </Step>

  <Step title="Choose an aggregation type">
    Select how the event should be aggregated:

    | Aggregation          | Description                                                |
    | :------------------- | :--------------------------------------------------------- |
    | **Unique Users**     | Count of distinct users who triggered this event           |
    | **Total Events**     | Total number of event occurrences                          |
    | **Property Sum**     | Sum of a numeric event property across all occurrences     |
    | **Property Average** | Average of a numeric event property across all occurrences |

    If you choose **Property Sum** or **Property Average**, an additional **Property** dropdown appears. Select the numeric property to aggregate — available properties are automatically discovered from your imported event data.
  </Step>

  <Step title="Set the target direction">
    Choose whether a higher or lower value indicates improvement:

    * **Increase** ↑ — Higher values are better (e.g., conversion rate, revenue)
    * **Decrease** ↓ — Lower values are better (e.g., error rate, churn)

    Portal uses the target direction to visually indicate whether metric trends are positive or negative.
  </Step>

  <Step title="Create the metric">
    Click **Create**. The metric will begin computing from your imported event data and will appear in your Data Integrations dashboard.
  </Step>
</Steps>

## Associating metrics with routers

Custom metrics can be linked to specific routers. When associated, the router's dashboard shows the metric trend broken down by route and variant — so you can directly compare how different routing configurations affect your KPIs.

To associate a metric with a router, you can either:

* Select the router when creating the metric
* Edit an existing metric and add router associations

## Editing and deleting metrics

Navigate to the **Data Integrations** page and click on a metric to edit it. You can update:

* **Display name** and **description**
* **Event**, **aggregation type**, and **property**
* **Target direction**
* **Router associations**

<Note>
  The metric identifier (shown as "Name" when editing) is set at creation time and cannot be changed.
</Note>

To delete a metric, open it for editing and click **Delete**.
