Filtering data

When working with Exponea, you can use customer and event attributes as well as time ranges to specify and filter the data outputs you seek. This is an essential function that you will be using on a daily basis whether you work with analyses or campaigns. Therefore, it is crucial you understand how filtering data in Exponea works, which we will explain to you in this guide.

This guide will help you understand:
  • What types of filters are used in Exponea
  • How each type works
  • The difference between customer and event filters
  • What are operators and how you can use them
  • How to use negation

Your customers can also be filtered on a project level using the Email list hygiene filter.

Types of filters

There are 3 types of filters that you can find across all functions in Exponea:

  1. Date filters
  2. Customer filters
  3. Event filters
All 3 types of filters present (not only) when creating a metric

All 3 types of filters present (not only) when creating a metric

Date filters

Date filters allow you to select events that only happened within a certain time range. They work with the attribute timestamp that is automatically tracked for every event, or any attribute using the UNIX timestamp format. They are available whenever you use events for filtering. Timestamp is not available for customer attributes as these are static (as opposed to events).

You will notice that for reports, for example, you can specify a date filter for the whole report, but also for every metric individually within that report. In that case, they work with AND relationship and Exponea takes the intersection of them. Date filters for reports do not influence events in customer filter funnels.

Once you click on the date filter, you will notice that you can either work with absolute or relative date ranges.

Absolute date range
This works with a specific and static date range. For example, you can filter only events that happened between January 1st, 2015 and March 1st, 2016. You can remove the absolute restraint from one side by using the From start and Until now checkboxes that will appear once you click on this option. Using the example above, you can filter events that happened between January 1st, 2015 - until now, whereas the latter is relative and will always refer to the actual day.

Relative date range
As opposed to the absolute date range, this filter is relative to the current time based on the chosen time unit and hence will be constantly changing. Keep in mind these rules as they will profoundly change what outputs you receive:

  • When working with days, the start of the period is the midnight of the specified day.
  • For months, the start of the period is the 1st day of the specified month.
  • The same logic applies to all other time units.
Example

The current time is June 2, 15:00. If you filter last 1 day you will get events that happened only today from 00:00, covering only 15 hours. If you want to cover the full 24 hours even going back to the previous day, then you need to select the option last 24 hours.

The relative range can be selected from predetermined quick options or fully customized.

If not sure, the calendar will always show you which date range you selected. This GIF was taken on June 2nd 2019.

If not sure, the calendar will always show you which date range you selected. This GIF was taken on June 2nd 2019.

Don't forget

Using "last 1 week" may give you different results than "last 7 days" as explained above.

Customer filters

Customer filters can be specified when working with customer attributes as well as event metrics. These are essentially Funnels which you can read more about in the separate guide.

You can work with more customer filters and combine them using mathematical AND and OR logic, as shown in the screenshot below.

Customers can be filtered either based on attributes or funnels.

Based on attributes

This filter will work with static (email, name, etc.) or derived (segmentations, expressions, etc.) customer attributes to determine whether a customer matches the filter or not.

Based on funnels

This filter works with events of customers to determine whether a customer matches the filter or not. When working with this filter, the global date filter (in reports for example) does not apply on the events specified within the funnel.

Please refer to the Funnels article to get a full understanding of this feature.

This will filter customers who have the event "first_session" tracked in their history (ever) AND have attribute "age" that is equal to 15.

This will filter customers who have the event "first_session" tracked in their history (ever) AND have attribute "age" that is equal to 15.

Event filters

You can specify each event by its attributes. If you use more attributes at once, they are combined using AND logic, meaning the output will satisfy all conditions defined.

This will add up only the value of those purchases that had a value greater than 1000.

This will add up only the value of those purchases that had a value greater than 1000.

Using customer vs event filters

It might often be difficult to know which filter to use (and how) to achieve your desired output. While this will improve quickly with your experience, consider this example to get a better understanding of how these filters work.

You want to count how many times were viewed products with a price greater than 100.

Usually, our users approach this in two ways. Can you guess which one is correct and why?

Example 1

Example 1

Example 2

Example 2

The first screenshot depicts the correct way of achieving your desired output, while the second one is incorrect.

In the first example, you only count those product views where the price of that viewed product is greater than 100. Exactly what you want.

In the second example, however, you count all product views only done by customers who at any point in their history viewed a product with a price > 100. So if a customer A viewed product 1 with a price of 200 and then product 2 with a price of 30, your filter would count 2 events. However, if customer B only viewed product 3 with a price of 40 and product 4 with a price of 50, your filter would not count any of those events as this customer never viewed a product with a price >100 and hence does not satisfy the funnel. This is obviously not the output you are seeking.

Operators

By operators, we mean the conditions you use to define a filter, such as "equal to", "greater then", "is true" etc. They are used in customer filters as well as event filters.

When choosing an operator, you can compare either to a static value (a number) or to another attribute by clicking on the Pi button.

There are 5 categories of operators as well as 4 special ones:

is set

Is true if the attribute is filled, even with 'empty' value, e.g. string with the length of 0.

is not set

Is true if the attribute is not filled at all (is null).

has value

Is true if the attribute is filled with some non-empty value (e.g. string with length > 0).

has no value

Is true if the attribute is filled, but with an empty value (e.g. string with the length of 0).

String operators

String operators compare the exact match of characters to the specified value as in the following image:

All the operators are explained in the following table:

equals

The value must be identical to this string.

does not equal

The value must be set, but different than the specified string. Read more about how to use negation later in this guide.

in

The value must be matching one of the strings selected from a list.

not in

The value must be different than all specified values - value must be set, but different than the specified values. Read more about how to use negation later in this guide.

contains

The value specified must be a part of the attribute.

does not contain

The value specified must not be a part of the attribute. Read more about how to use negation later in this guide.

starts with

The value must be identical to the first characters of the string.

ends with

The value must be identical to the last characters of the string.

matches regexp

The value must match the regular expression function. You can use a standard regexp as defined [on this link](https://github.com/google/re2/wiki/Syntax). By default, the regexp is not case sensitive but it can you can make it so by following [this guide](https://www.regular-expressions.info/modifiers.html
https://exponea.slack.com/archives/DLPBR5W5V/p1570453418000200).

Number operators

Number operators work with values which are numbers and can be mathematically compared:

  • equals
  • in between
  • less than
  • more than

A common error

Remember that a statement such as more than 1000 (or less than) excludes that value itself. A mistake is often made in segmentations for example, when one segment is filtered as age is less than 18 and the other as age is more than 18, so those who are 18 don't fall into any group!

Boolean operators

Boolean operators work with the values "true" and "false" and also with "1" and "0". If an attribute doesn't have any value or has a value different to these, neither of these operators will select it.

is true

is false

Date operators

These operators compare attributes that are in the date format to the current time.

more than

A relative time period in the past or future that is further away than the specified time restraint.

less than

A relative time period in the past or future that is closer than the specified time restraint.

matches range

Any date within the specified absolute date range.

matches current day

If the day of the month of the date attribute matches the day of the month of the current day.

matches current month

If the month of the date attribute matches the current month.

matches current year

If the year of the date attribute matches the current year.

second matches

Checks whether your event happened in a given second of a minute. Can be a number between 1-60.

minute matches

Checks whether your event happened in a given minute of an hour. Can be a number between 1-60.

hour matches

Checks whether your event happened in a given hour of a day. Can be a number between 1-24.

weekday matches

Checks whether your event happened on a given day of a week. Can be a number between 1-7 (1 = Monday).

day matches

Checks whether your event happened on a given day of a month. Can be a number between 1-31.

month matches

Checks whether your event happened in a given month of a year. Can be a number between 1-12.

year matches

Checks whether your event happened in a given year. Enter the actual number of the year (such as 2019).

See our examples to understand better how to work with these operators.

Supported time formats

  • UNIX timestamp
  • Y-M-D, Y-M-D H:M, Y-M-D H: M: S,
  • D-M-Y, D-M-Y H:M, D-M-Y H: M:S
  • M/D/Y, M/D/Y H:M, M/D/Y H: M:S
  • D.M.Y, D.M.Y H:M, D.M.Y H: M:S

List operators

list operators combine one of the previous operators with an ability to choose if all items from the list must fulfill the conditions or if it's enough that at least one item fulfills the condition.

Negation

Using negation is often a better way how to get your desired outcome. There are two ways how you can negate a filter:

1. Use a negation from the drop-down within the filter.

This kind of negation will literally choose only customers meeting given conditions. E.g. when choosing customers which email doesn't contain a certain word, this will show only those customers. It will not show customers without email set at all.

2. Use negation for the whole filter.

This kind of negation will choose customers not meeting given conditions. The main difference to direct negation showed above is that this negation will include customers without set attribute as well. E.g. when choosing customers whose email doesn't contain a certain word, this will show those customers + customers without email set. To enable this negation, you need to click on the "N" button located on the right side as indicated in the screenshot below.

Notice that this approach filters more customers than in the screenshot above.

Notice that this approach filters more customers than in the screenshot above.

Examples

Filter customers who have an anniversary of purchase today

"Today" is relative and always refers to the current day. This will represent a yearly cycle

Filter customers who purchased on the first day (1.1.) of any year

This refers to a fixed day in a year

Filtering data


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.