When working with Bloomreach Engagement, 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 you will use on a daily basis whether you work with analyses or campaigns.
# This guide will help you understand:
The types of filters used in Bloomreach Engagement
The difference between customer and event filters
What are operators and how to 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 Bloomreach Engagement:
## 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 Bloomreach Engagement 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.
|The current time is June 2, 15:00. If you filter `|
The relative range can be selected from predetermined quick options or fully customized.
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.**
|Column Title||Column Title|
|**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 the 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 to the events specified within the funnel.|
Please refer to the [Funnels](🔗) article to get a full understanding of this feature.
### Customer filter templates
This feature makes it possible to save frequently used customer filter conditions into a template, which can be re-used later to pre-fill conditions in any customer filter.
filtering out your most valuable customer base using a specific list of conditions, then saving this filter as a template and re-using the same set of conditions in the email campaign audience filter.
if you want to re-use condition nodes in scenarios that include tens of different conditions, you can save the filter as a template and re-use it in condition nodes in another scenario (no need to duplicate the whole scenario anymore).
prepare frequently used filters for your company (e.g. list of most valuable customers), a list of people who purchased today, or a list of people you need to be excluded from any kind of campaign.
customer filter templates work as an assisting feature, that helps you fill out frequently used conditions faster However, keep in mind that once the template is changed, changes are not propagated to all places where the template was used. in case you’d like to keep this reference, we advise using segmentations instead.
The feature will be universally accessible in all places where a customer filter can be used, including:
Scenarios (condition node)
Data & Assets > Customers
## 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.
# 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?
**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 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.
By operators, we mean the conditions you use to define a filter, such as "equal to", "greater than", "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:
|Column Title||Column Title|
|**is set**||Is true if the attribute is filled, even with an '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:
|Column Title||Column Title|
|**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 operands selected from a list. There is a limit of 5 000 entered operands.|
|**not in**||The value must be different than all specified values - the value must be set, but different than the specified values. There is a limit of 5 000 entered 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 **-0": "**in**",**(<https://github.com/google/re2/wiki/Syntax>). By default, the regexp is not case sensitive but you can make it so by the following inline case-sensitive flag **(?-i)** e.g. (?-i).\*[a-z].\* (<https://www.regular-expressions.info/modifiers.html>).|
Number data types
Please bear in mind that while the filters ‘equals’ and ‘does not equal’ work for number data types, all other filters in ‘strings’ fail to work with data type numbers.
The operators are case-sensitive only when you are configuring them in the [recommendations](🔗).
## Number operators
Number operators work with values which are numbers and can be mathematically compared:
A common errors
A statement such as `
more than 1000` (or less than) **excludes** the value itself. A frequent mistake made in segmentations, for example, is 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!
Another common error is when using the `
in between` operator which includes both limit values. This means that when you create two segments, such as `
in between 0 and 50` and `
in between 50 and 100`, the value 50 of that given attribute will be included in both segments.
## 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.
## Date operators
These operators compare attributes that are in the date format to the current time.
|Column Title||Column Title|
|**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
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.
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 the given conditions. The main difference to direct negation shown 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.
# Filtering logic
Our filtering data logic is based on mathematical [De Morgan's laws](🔗) that explain the boolean logic behind the operators OR and AND in terms of negotiation. Let's give you an example scenario: You would like to filter customers who had marketing consent **AND** who did **NOT** buy product_123 **AND** did **NOT** buy product_456. So you would like to exclude all users that bought product_123 and product_456. In the filtering, you should therefore use this filter logic: `
A AND (NOT B OR NOT C)` as it agrees with De Morgan's laws.
### **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_