For the complete documentation index, see llms.txt. This page is also available as Markdown.

Segment metrics

Choose the counts your teams see on every segment, on top of the UserPoint total.

Your goal

Add the counts that matter to your teams - reachable emails, known accounts, addressable cookies or mobile IDs - to every segment in a datamart, so nobody has to run a query to answer "how many of these users can I actually reach?".

Expected outcome

Segment listing and segment detail pages show your custom metrics alongside the UserPoint total, and the values are refreshed and kept as a history.

What a segment metric is

A segment metric is a custom metric offered on segments across a datamart. Metrics are visible on the segment listing and on segment detail pages, and the value of each metric is calculated regularly for every segment and saved, which gives you a historic view of how it evolves.

Segment metrics are configured per datamart and built on top of OTQL queries.

A metric counts how many UserPoints in the segment have at least one matching record - not how many records the segment contains. If you add a metric counting cookies and a UserPoint has several cookies, it counts as +1, not +2. Metric values are therefore always lower than or equal to the number of UserPoints in the segment.

What each metric is made of

Field
What it holds

Query

An OTQL query returning a number.

Technical name

One of emails, user_accounts, desktop_cookie_ids, mobile_cookie_ids, mobile_ad_ids. Custom values are not allowed, and each value can be used only once per datamart.

Display name

The label shown in the interface.

Status

DRAFT, LIVE, or ARCHIVED.

Icon

Chosen from a fixed catalogue. Commonly used icons are display, users, email-inverted, and phone.

Set up a metric

1

Write and save the OTQL query

The query must return a number. Because every datamart has its own schema, test the query on the datamart concerned - in the Query Tool or by API - before you use it.

Common shapes:

The configured query is merged with the query of each segment to produce that segment's value, so write it as a datamart-wide count, not as a count for one segment.

2

Create the metric

Metrics are created in DRAFT status:

3

Publish it

Publishing transitions the metric from DRAFT to LIVE. Any existing LIVE metric with the same technical name is archived automatically.

4

Check it on a segment

Open any segment in the datamart. The metric should appear next to the UserPoint total once values have been calculated.

Existing metrics can be listed with GET /v1/datamarts/:datamartId/audience_segment_metrics, and removed with DELETE /v1/datamarts/:datamartId/audience_segment_metrics/:metricId.

Lifecycle

A metric goes from DRAFT to LIVE, and from LIVE to ARCHIVED. An ARCHIVED metric cannot be republished - it can only be removed.

Limitations

  • 10 custom metrics per datamart at most.

  • @cardinality aggregations are not supported in metric queries.

See Platform limits for the other documented ceilings.

Troubleshooting

Symptom
Likely cause

The metric is rejected on creation

The technical name is not one of the allowed values, or it is already used by another metric on the datamart.

The metric shows no value

The query does not return a number on this datamart's schema. Test it in the Query Tool first.

The value looks lower than expected

Metrics count UserPoints having at least one record, not records.

Publishing removed an existing metric

Publishing a metric archives the LIVE metric that shares its technical name.

Last updated

Was this helpful?