Filters in segmentation

On various different pages on MoEngage dashboard events, event attributes, user attributes can be filtered to get to the desired analysis or users. To get the right analysis and the right set of users, it's very important to know the filters.

This article explains how these filters work and if there are any different behavior or these filters on different pages. 

Data Types

In MoEngage dashboard, there are 4 primary data types.

  • String
    String is a sequence of characters. Strings are typically used to represent words and text. Character in a string can be a letter of some alphabet, a digit, a punctuation mark, a blank space, etc.

  • Boolean
    The Boolean data type can have values as true and false.

  • Numeric
    Number is a sequence of digits . Numeric data types are typically used to represent amount, quantity , price.

  • Geo Location
    Geo Location represent the location on the map using latitude and longitude.

  • Date Time
    Date time data types represent the date and time for and event or action.


Terms to know

1. Key - Field which holds the value of an attribute.
2. Key not set - The field is not present to hold the value of the attribute.

 

String Filters

Operator Explanation
is stored value is an exact match with the filter value
exists Key Exists (Anything but NULL)
contains stored value contains filter value
starts with stored value starts with the filter value
ends with stored value ends with the filter value
in the following stored value is an exact match for one of the filter value
is not  stored value does not match with the filter value (stored value includes the attributes where Key is not set)
does not exist Key not set
does not contain stored value does not contain filter value (stored value includes the attributes where Key is not set)
does not start with stored does not start with the filter value (stored value includes the attributes where Key is not set)
does not end with stored does not end with the filter value (stored value includes the attributes where Key is not set)
not in the following stored value is not a match to any of the filter values (stored value includes the attributes where Key is not set)

Key Exists

Key is a record in database. Key exists means that record exists. This record can have value, or it can be empty value (represented as empty string) or it can be Null (unknown) as well.

Boolean Filters

Operator Explanation
is stored value is an exact match with the filter value
exists Key exists (Anything but NULL)
does not exist Key not set

 
 

Numeric Filters

For the table below - n, n1, and n2 are numeric and n2 > n1.

Operator Explanation
is equal to stored value is a exact match with the filter value
is not equal to stored value is not a match to the filter value (stored value includes the attributes where Key is not set)
is between n1 <= stored value AND stored value < n2
is not between n1 > stored value OR stored value >= n2
is less than stored value < filter value
is greater than stored value > filter value
in the following stored value is an exact match for one of the filter value
not in the following stored value does not match with any of the filter values (stored value includes the attributes where Key is not set)
exists key exists (Anything but NULL)
does not exist key not set

 

Geo Location Filters

Operator Explanation
Point with Radius stored geolocation lies within the circle defined by the point and the radius

 
 

Date Time Filters

To understand filter operators in date-time data types, we need to first understand few functions -

  • now = current timestamp up to milliseconds

  • start_of_day(timestamp) = 00:00:00 of the selected day/date

  • end_of_day(timestamp) = 23:59:59 of the selected day/date

  • n days = n * 24 hours
  • For the table below - n, n1, and n2 are numeric and n2 > n1.

 

For example

  • Let's assume now is 7:30:05 PM, 5 Jan 2001 then
    • now - 3 days = now - (3* 24) hours = 7:30:05 PM, 2 Jan 2001
    • now + 3 days = now + (3* 24) hours = 7:30:05 PM, 8 Jan 2001
    • start of the day (now) = 12:00:00 AM, 5 Jan 2001
    • end of the day (now) = 11:59:59 PM, 5 Jan 2001
  • Let's assume date is 1 Jan 2001
    • start of day (date) = 12:00:00 AM, 1 Jan 2001
    • end of day (date) = 11:59:59 PM, 1 Jan 2001
Operator Filter Value Type Explanation
in the last n days Segmentation Page:
from = (now - n days), to = now
Analytics Page: 
from = start_of_day(now - n days), to = now
on date from = start_of_day(date), to = end_of_day(date)
days ago from = start_of_day(now - n days),
to = end_of_day(now - n days)
days from now from = start_of_day(now + n days),
to = end_of_day(now + n days)
is between   date Segmentation Page:
from = start_of_day(date1), to = start_of_day(date2)
Analytics Page:
from = start_of_day(date1), to = end_of_day(date2)
days ago from = start_of_day(now - n2 days),
to = start_of_day(now - n1 days)
days from now from = start_of_day(now + n1 days),
to = start_of_day(now + n2 days)
before  date to = start_of_day(date)
days ago to = start_of_day(now - n days)
after  date from = end_of_day(date)
days from now  from = end_of_day(now + n days)
in the next days from = now, to = now + n days
is today   from = start_of_day(now), to = now
exists   key exists (Anything but NULL)
does not exist   key not set


Here Segmentation Pages are - All the campaign pages and Create Segment Page.
Analytics Pages are - Behavior, Funnel, Cohort, Session & source, User Paths, and Predictive Segments page.

 

Change of filter definitions

MoEngage is changing a few of the segmentation filters definitions. The new definitions are given below.

The new definitions will be effective from :

  • For India region - 17th Nov 2020,
  • For the European region - 18th Nov 2020,
  • For US region - 19th Nov 2020

By default, the data is stored in the US region for all clients, except European clients. Connect with your CSM if you do not know which region your data is stored in.


New Definations:

a. Last n Day Filters -
The definition for these filters will be -

Last n Days:  from = start_of_day(now - n days), to = now
For Example - Let’s assume now = 7:30:05 PM, 5 Jan 2001
then Last 3 Days:  from = 12:00:00 AM 2 Jan 2001  to = now (7:30:05 PM, 5 Jan 2001).

 

b. In the next n Day Filters -
The definition for these filters will be -
In the next n Days:  from = now, to = end_of_day(now + n days)
For Example - Let’s assume now = 7:30:05 PM, 5 Jan 2001
then In the next 3 Days:  from = 7:30:05 PM, 5 Jan 2001   to = 11:59:59 PM, 8 Jan 2001.

 

c. In between -
The definition for these filters will be -
from = start_of_day(date1), to = end_of_day(date2)
This works similar for days ago and days from now , to = end_of_day(date2)
For Example - Date 1 = 5 Jan 2001    Date 2 = 8 Jan 2001
then in between filter should be:  from = 12:00:00 AM 5 Jan 2001  to = 11:59:59 PM, 8 Jan 2001

 

d. Doesn’t contain
The definition for these filters will be -
The system will check for the value in fields where the key exist.
If the key doesn’t exist, the system will also include them in the evaluation.

 

e. is today
The definition for these filters should be -
from = start_of_day(today), to = end_of_day(today)
For example - Let’s assume Today = 5 Jan 2001
then in toady filter should be:  from = 12:00:00 AM 5 Jan 2001  to = 11:59:59 PM, 5 Jan 2001

 

f. before n days ago
The definition for these filters should be -
to = end_of_day(now - (n+1) days)
For example - Let’s assume Today = 5 Jan 2001
then Before 3 days ago filter should be:  to = 11:59:59 PM, 1 Jan 2001

 

g. After
from = start_of_day(date +1 day)
For example - Let’s assume Date = 5 Jan 2001
then After 5 Jan 2001 filter should be:  from = 12:00:00 AM 6 Jan 2001

 

h. After n days from now
from = start_of_day(now + (n+1) days)
For example - Let’s assume now = 7:30:05 PM, 5 Jan 2001
then After 3 days from now  filter should be:  from = 12:00:00 AM 9 Jan 2001

Was this article helpful?
0 out of 0 found this helpful