Learn how to use the filters[] parameter to filter your data with flexible syntax for different dimension types.
The filters[] parameter allows you to filter your data using flexible syntax that supports different types of operations depending on the dimension type.
The basic format for all filters is:
filters[]=<operation><dimension>:<value>
<operation> is the optional prefix that defines the type of filter. Examples:
country:US! → not equals → !country:US+ → set contains → +video_cdn_trace:fastly- → set omits → -video_cdn_trace:cloudflare<dimension> is the field or metric you want to filter on.
Examples: country, operating_system, video_cdn_trace
: acts as the separator between the dimension and the value.
<value> is the value you're comparing against. Examples:
US, windows[fastly,akamai][]Scalar operations can be used with single-value dimensions or simple key-value pairs. Use these operations when you want to filter by an exact match or exclusion.
| Syntax | Operation | Example | Description |
|---|---|---|---|
dimension:value | Equals | filters[]=country:US | Field equals value |
!dimension:value | Not equals | filters[]=!operating_system:windows | Field does not equal value |
Use for trace dimensions that can have multiple values in an ordered list. Use these operations when you want to check if a single value appears in the trace dimension.
| Syntax | Operation | Example | Description |
|---|---|---|---|
+dimension:value | Has | filters[]=+video_cdn_trace:fastly | Set contains value |
-dimension:value | Omits | filters[]=-video_cdn_trace:cloudflare | Set does NOT contain value |
Please note that set operations cannot be used as a wildcard for substring searches. For example, filters[]=+video_cdn_trace:fas cannot be used to return views with CDN traces that contain fastly.
Use for trace dimensions that can have multiple values in an ordered list. Use this operation when you want to filter for an exact, ordered match.
| Syntax | Operation | Example | Description |
|---|---|---|---|
dimension:[value1,value2] | Equals | filters[]=video_cdn_trace:[fastly,akamai] | Trace equals exactly [fastly, akamai] |
Filter for views from the US:
filters[]=country:USExclude mobile operating systems:
filters[]=!operating_system:mobileFind views with 'fastly' as a CDN value in the video_cdn_trace dimension.
filters[]=+video_cdn_trace:fastlyExclude views that went through cloudflare:
filters[]=-video_cdn_trace:cloudflareFind views that went through exactly fastly first, then akamai:
filters[]=video_cdn_trace:[fastly,akamai]Find views where no CDN value was set:
filters[]=video_cdn_trace:[]You can combine multiple filters.
Filters with different dimensions
When you are combining filters with different dimensions they are combined with AND.
# Views from US AND went through fastly
filters[]=country:US
filters[]=+video_cdn_trace:fastlyYou can also combine dimensions with the same dimension. These are combined with OR.
# Views from US OR Canada
filters[]=country:US
filters[]=country:CAHowever, if you are combining filters with the same dimension value with a negated value, those are combined using AND.
# Views NOT from US AND NOT from Canada
filters[]=!country:US
filters[]=!country:CAcountry:US)video_cdn_trace:[a,b,c])video_cdn_trace:[])❌ Don't use brackets with set operators:
filters[]=+video_cdn_trace:[fastly] # Invalid✅ Correct:
filters[]=+video_cdn_trace:fastly # Valid❌ Don't use scalar operator syntax with trace dimensions:
filters[]=video_cdn_trace:fastly # Invalid✅ Use trace or set operator syntax with trace dimensions:
filters[]=video_cdn_trace:[fastly] # Exact match
filters[]=+video_cdn_trace:fastly # Contains checkWhen using filters in URLs, remember to properly encode the parameters:
# Single filter
/metrics?filters[]=country:US
# Multiple filters
/metrics?filters[]=country:US&filters[]=+tags:beta&filters[]=video_cdn_trace:[fastly,akamai]
# URL encoded
/metrics?filters%5B%5D=country%3AUS&filters%5B%5D=%2Btags%3Abeta&filters%5B%5D=video_cdn_trace%3A%5Bfastly%2Cakamai%5DHere's an example of how you can URL encode the filter params using JavaScript:
// Example filters
const filters = [
"country:US",
"+tags:beta",
"video_cdn_trace:[fastly,akamai]"
];
// Use URLSearchParams to build query string
const params = new URLSearchParams();
filters.forEach(f => params.append("filters[]", f));
// Full URL
const url = `/metrics?${params.toString()}`;
console.log(url);
// /metrics?filters%5B%5D=country%3AUS&filters%5B%5D=%2Btags%3Abeta&filters%5B%5D=video_cdn_trace%3A%5Bfastly%2Cakamai%5D# Views that went through cloudflare but not fastly
filters[]=-video_cdn_trace:fastly
filters[]=+video_cdn_trace:cloudflare# Exact CDN sequence analysis
filters[]=video_cdn_trace:[fastly,akamai,cloudfront]# Exclude slow CDN providers
filters[]=-video_cdn_trace:slow-cdn
filters[]=!operating_system:legacy# Mobile traffic analysis
filters[]=operating_system:ios
filters[]=operating_system:android# Exclude recorded content
filters[]=!content_type:recorded
filters[]=content_type:live# Web platform only, excluding mobile apps
filters[]=platform:web
filters[]=!platform:ios
filters[]=!platform:androidThe API will return validation errors for:
!+dimension:value)Example error response:
{
"error": "Sequence dimensions require bracket notation. Use video_cdn_trace:[value] instead of video_cdn_trace:value"
}To ensure your filters are working as expected, it can be helpful to limit the dataset you're working with. For that reason, you may wish to test your filters with a small date range first:
/metrics?timeframe[]=24:hours&filters[]=country:US&filters[]=+video_cdn_trace:akamai