> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/technical-reference/evaluations-and-observability/custom-analytics-fields-filters-and-aggregation.md).

# Custom Analytics: Fields, Filters, and Aggregation

Custom analytics summarize selected fields from recorded activity. Choose fields and aggregations that match the question the chart should answer.

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSQ1Sgy933krTyK0S4JpP%2Fuploads%2FvnpTf6csXv3tGm82OpwD%2FG077.mp4?alt=media&token=7c691632-03b6-4662-8fc0-12daab62568a>" %}

## Before you begin

Access to analytics and recorded runs containing the fields to report.

## Key concepts

| Term           | Definition                                                                                                                                  |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| Metadata       | Structured attributes associated with a source file or record. Consistent field names and types make filtering predictable.                 |
| Distinct count | A count of unique values within the metric’s defined scope. Daily distinct counts cannot generally be summed into a multi-day unique count. |
| Trace          | Details of the steps taken during a run. Use it to locate the first unexpected input, output, or error.                                     |

## Configuration options

| Option      | Purpose                                                                | Behavior                                                       |
| ----------- | ---------------------------------------------------------------------- | -------------------------------------------------------------- |
| Aggregation | A calculation over selected records, such as a count, sum, or average. | Choose one that matches the field type and reporting question. |
| Filter      | A condition that narrows the records eligible for an operation.        | A filter can exclude relevant content before ranking occurs.   |

## Configure an analytics chart

1. Create a chart and select its source fields.

![Review the reporting period and metrics before interpreting the results.](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/GozcbJnn9Fpcep22SVSm/assets/g077-g077-01-overview.png)

Review the reporting period and metrics before interpreting the results.

2. Choose the aggregation, date range, and filters.
3. Compare the chart with matching run records before using it in reporting.

The chart displays a meaningful summary of the selected records.

## Behavior and limitations

An empty chart can mean no matching data, a missing field, or a restrictive filter. It does not prove there were no runs. Numeric aggregation requires suitable values. Changing a chart does not create missing historical fields. Check access scope when different users see different totals.

## Related resources

[Inspect project analytics](https://docs.stackai.com/guides-and-quickstarts/evaluations-and-observability/inspect-project-analytics.md)

[Evaluation Datasets and Input Mapping](https://docs.stackai.com/technical-reference/evaluations-and-observability/evaluation-datasets-and-input-mapping.md)


---

# 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.stackai.com/technical-reference/evaluations-and-observability/custom-analytics-fields-filters-and-aggregation.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.
