Skip to main content
A custom metric is a formula over ad metrics, such as Meta adds to cart ÷ Link clicks. The workspace stores one definition. The Ads table, Reports cards, dashboards, share links, AI chat, and the MCP server all calculate it the same way, from the same data.

Create a custom metric

1

Open the builder

On Ads, select metrics, then New custom metric. On Reports, open the Metric picker in the New report sheet and select New custom metric.
2

Pick a type

Select Rate, Cost per, Ratio, or Formula.
3

Pick the metrics

Fill in the fields for that type. The table below lists them.
4

Check the value

On Ads, On screen shows the value for the rows in the table now.
5

Name it

Type a name in Name (optional), up to 60 characters. Leave it empty to keep the suggested name.
6

Save

Select Add metric. On Ads, the metric is added as a column.
A workspace holds up to 50 custom metrics. Every member can create, edit, and delete them.

Metrics you can use

A custom metric applies only to the platforms that report every metric in it. Meta adds to cart ÷ Link clicks applies to Meta only: Google and TikTok rows show –, and the total covers Meta rows only.

How the value is calculated

  • Each metric in the formula is summed first. The formula then runs once on the sums. A rate over three campaigns is total adds to cart ÷ total link clicks, not an average of three rates.
  • An unknown value makes the result –, never 0. A division by zero shows –.
  • Spend and conversion value are in the ad account’s currency. A total that adds accounts in different currencies shows –. A formula that uses DATALYR revenue and spend needs a USD ad account.
  • A formula can use up to 8 DATALYR events. The Ads table counts at most 8 DATALYR events across all visible columns.

Use it in Reports

In the New report sheet, pick the custom metric from the Custom group of the Metric picker. The card uses the same date range and accounts as Ads. Dashboard filters apply to a custom-metric card only when they filter by platform.

Use it in chat and agents

list_custom_metrics returns each custom metric with its ID, such as cm:cm_ab12cd34ef. Pass the ID to analytics_query on its own, grouped by platform or campaign, or with granularity: "day". Agents with the datalyr:write:reports scope can create, update, and delete custom metrics.

Edit or delete

Open the picker and select the pencil next to the metric. A change applies everywhere the metric is used. Select Delete to remove it. The toast offers Undo. A Reports card that uses a deleted metric shows that the metric was deleted.

Verify

Add the custom metric as a column on Ads. Compare its footer with a Reports metric tile for the same metric and date range. The two numbers are the same.