“filter” parameter

Two types of filters may be used:

  • one for metrics: numerical (e.g. greater than, lower than, etc.)
  • and one for dimensions: textual (e.g. starts with, contains, etc.)

To use “AND” filters, you just need a comma: filter={X:{operator:value},Y:{operator:value}}

To use “OR” filters, you must specify all filters in $OR{…,…} and separate them with a comma: filter={$OR:{{X:{operator:value}, Y:{ operator:value}}}

All operators are preceded by $. For string operators, it is necessary to put “value” in single quotation marks.

API operatorApplicationDescription
$eq:valueMetric/dimensionIs equal to
$gt:valueMetricIs greater than
$lt:valueMetricIs less than
$gte:valueMetricIs greater than or equal to
$lte:valueMetricIs less than or equal to
$neq:valueMetric/dimensionIs different
$lk:valueDimensionContains
$nlk:valueDimensionDoes not contain
$start:valueDimensionStarts with
$nstart:valueDimensionDoes not begin with
$end:valueDimensionEnds with
$nend:valueDimensionDoes not end with
$empty:trueDimensionIs empty
$empty:falseDimensionIs not empty
$in:{value1,value2,…}Metric/dimensionIs equal to value1 or value2
$nin:{value1,value2,…}Metric/dimensionIs different than value1 and value2
$inlk:{value1,value2,…}DimensionContains value1 or value2
$ninlk:{value1,value2,…}DimensionDoes not contain value1 and value2
$id:123456Custom Site/Page Variables using the ID formatItem ID is 123456
$nid:123456Custom Site/Page Variables using the ID formatItem ID is NOT 123456
$lkw:value“Pages” Dimension onlyContains the word
$nlkw:value“Pages” Dimension onlyDoes not contain the word
$inlkw:{value1,value2,…}“Pages” Dimension onlyContains the word value1 or value2
$ninlkw:{value1,value2,…}“Pages” Dimension onlyDoes not contain the words value1 and value2

Example:
filter={m_sales:{$lt:150},$OR:{d_page:{$lk:'home'},d_page:{$eq:'engines'}}

In this example, the following chain can be read:
Sales (m_sales) must be less than 150 AND (
the “pages” dimension (d_page) must contain “home”
OR the “pages” dimension (d_page) must equal “engines”
)

It is not possible to apply OR filters between two different columns.
Filters are applied to raw data, in the language of the returned results. In the above example; the filter sources = “engines” only works in English. If the results are requested in any other language, this filter will not return any results.
The filters do not apply to variations (for example “columns”), nor do they apply to ratios in relation to the total row.

 

Was this post helpful?

Last update: 19/11/2018