Skip to main content

Filter

Overview​

The filter object allows you to filter your dataset on both properties and metrics using various comparison operators. Filters support logical operations and multiple values.

Parameters​

Number Filters​

ParameterDescriptionValuesRequired
$eqEquals toNumberNo
$neqDoes not equal toNumberNo
$inValue is in arrayArray of numbersNo
$gtGreater thanNumberNo
$gteGreater or equal toNumberNo
$ltLess thanNumberNo
$lteLess than or equal toNumberNo
$naNULL valuetrue or falseNo
$undefinedUndefined valuetrue or falseNo
$emptyCombination of $na and $undefinedtrue or falseNo

String Filters​

ParameterDescriptionValuesRequired
$eqEquals toStringNo
$neqDoes not equal toStringNo
$inValue is in arrayArray of stringsNo
$lkContainsStringNo
$nlkDoes not containStringNo
$startStarts withStringNo
$nstartDoes not start withStringNo
$endEnds withStringNo
$nendDoes not end withStringNo
$naNULL valuetrue or falseNo
$undefinedUndefined valuetrue or falseNo
$emptyCombination of $na and $undefinedtrue or falseNo

Date Filters​

ParameterDescriptionValuesRequired
$eqEquals toDate stringNo
$gtGreater thanDate stringNo
$gteGreater or equal toDate stringNo
$ltLess thanDate stringNo
$lteLess than or equal toDate stringNo

Boolean Filters​

ParameterDescriptionValuesRequired
$eqEquals totrue or falseNo
$neqDoes not equal totrue or falseNo
$naNULL valuetrue or falseNo
$undefinedUndefined valuetrue or falseNo
$emptyCombination of $na and $undefinedtrue or falseNo
note

For all filter types, you can filter on multiple values by using arrays. For example: "$lk": ["A", "B", "C"] creates an OR condition.

Examples​

Example 1: Complex filter with logical operations​

Filter for visits equal to 19 AND device type is Tablet or Desktop AND source starts with "Referrer".

{
"filter": {
"metric": {
"m_visits": {
"$eq": 19
}
},
"property": {
"$AND": [
{
"$OR": [{
"device_type": {
"$in": ["Tablet", "Desktop"]
}
}]
},
{
"visit_src": {
"$start": "Referrer"
}
}
]
}
}
}

Example 2: Simple property filter​

Filter for desktop devices only.

{
"filter": {
"property": {
"device_type": {
"$eq": "Desktop"
}
}
}
}