“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 operator Application Description
$eq:value Metric/dimension Is equal to
$gt:value Metric Is greater than
$lt:value Metric Is less than
$gte:value Metric Is greater than or equal to
$lte:value Metric Is less than or equal to
$neq:value Metric/dimension Is different
$lk:value Dimension Contains
$nlk:value Dimension Does not contain
$start:value Dimension Starts with
$nstart:value Dimension Does not begin with
$end:value Dimension Ends with
$nend:value Dimension Does not end with
$empty:true Dimension Is empty
$empty:false Dimension Is not empty
$in:{value1,value2,…} Metric/dimension Is equal to value1 or value2
$nin:{value1,value2,…} Metric/dimension Is different than value1 and value2
$inlk:{value1,value2,…} Dimension Contains value1 or value2
$ninlk:{value1,value2,…} Dimension Does not contain value1 and value2
$id:123456 Custom Site/Page Variables using the ID format Item ID is 123456
$nid:123456 Custom Site/Page Variables using the ID format Item ID is NOT 123456
$lkw:value “Pages” Dimension only Contains the word
$nlkw:value “Pages” Dimension only Does not contain the word
$inlkw:{value1,value2,…} “Pages” Dimension only Contains the word value1 or value2
$ninlkw:{value1,value2,…} “Pages” Dimension only Does 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?
Yes
No
Last update: 19/11/2018