> For the complete documentation index, see [llms.txt](https://docs.elevateab.com/elevate-helpcenter/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.elevateab.com/elevate-helpcenter/developer-reference/external-api/filters.md).

# Filters

Filter Elevate A/B Testing External API results by device, country, UTM, custom event, order total, and more with query parameters.

`/summary`, `/results`, `/timeseries` and `/segments/{view}` take filters as query parameters. A filter narrows the experiment to the visitors it matches, and every metric in the response is recalculated for them.

```plaintext
?size=MOBILE&country_not=US%7CGB&utm_campaign_contains=summer
```

## Writing a filter

Each field takes an operator as a suffix:

| Parameter        | Matches visitors whose value...           |
| ---------------- | ----------------------------------------- |
| `field`          | equals one of the values                  |
| `field_not`      | equals none of the values                 |
| `field_contains` | contains one of the values, ignoring case |

* Separate several values with `|` (URL-encoded `%7C`). Commas are part of a value.
* Several values of one field match any of them; different fields must all match.
* One operator per field per request.

## Fields with fixed values

| Field          | Operators                | Values                                 |
| -------------- | ------------------------ | -------------------------------------- |
| `size`         | `size`, `size_not`       | `MOBILE`, `DESKTOP`, `TABLET`          |
| `country`      | `country`, `country_not` | ISO country codes such as `US`         |
| `currency`     | `currency`               | One ISO currency code such as `USD`    |
| `visitor_type` | `visitor_type`           | `new_visitors` or `returning_visitors` |
| `custom_event` | `custom_event`           | Tracking IDs from `/custom-events`     |

## Fields with values from your traffic

Use [filter values](https://docs.elevateab.com/elevate-helpcenter/developer-reference/external-api/filters#finding-values) to see what a field holds in an experiment.

| Field                                                                 | Operators                         |
| --------------------------------------------------------------------- | --------------------------------- |
| `browser`, `os`, `region`, `city`, `sales_channel`                    | `field`, `field_not`              |
| `source`, `referrer_url`, `entry_path`, `page_entry`, `page_url`      | `field`, `field_not`, `_contains` |
| `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, `utm_term` | `field`, `field_not`, `_contains` |

{% hint style="info" %}
Exact matches are case sensitive on these fields, so use `_contains` when you are unsure of the spelling.
{% endhint %}

## Order total and products

| Parameter                                            | Matches                                                               |
| ---------------------------------------------------- | --------------------------------------------------------------------- |
| `order_total_gt`, `order_total_lt`, `order_total_eq` | Orders whose subtotal is above, below or equal to one amount          |
| `selected_products`                                  | Limits product metrics to the product IDs you list, separated by `\|` |

Send one order total comparison per request, as an amount in the store currency such as `order_total_gt=50`. Leave `selected_products` out for the products the experiment targets, or send it empty for all products.

Every response echoes what it applied in `appliedFilters`, so you can check your filters were read the way you meant.

## Finding values

Not sure what a field holds? [`/filter-values`](/elevate-helpcenter/developer-reference/external-api/api-reference/filter-values.md) lists the values an experiment actually saw, most common first, so you can offer them as choices or check a spelling before filtering.
