Segmenting

Overview

Sending relevant messages to customer segments is key to increasing engagement and sales. Filters let you create customer segments in a powerful, flexible and human-readable way. Here are some basic use cases to get you started:

Use Case Filter
Get at-risk customers tag_active = 'at_risk'
Get customers with predicted customer lifetime value of more than $2000 clv > 2000
Get customers who made only one purchase no_of_purchases = 1
Get customers who have not bought since 31 December 2015 last_purchase < '2015-12-31'
Get at-risk customers with customer lifetime value of $500 or more tag_active = 'at_risk' and clv >= 500
Get customers in cluster 1 or 2 cluster_id = 1 or cluster_id = 2
Get customers who signed up yesterday first_signup = {{date:1d}}
Get customers who bought less than 4 weeks ago last_purchase > {{date:4w}}

Creating a basic filter

Use our filtering interface (Insight - Customers - Create Filter) to get a sense of how to create customer segments. You can get a good idea of how filters work by playing around.

If you decide to venture into the advanced realm, read more below.

Creating an advanced filter

Expressions

Expressions are the basic building block of a filter. They take the following form:

{{field}} {{operator}} {{value}}

For instance, in the expression below, last_purchase is the field, < is the operator and '2015-12-31' is the operator. This filters customers whose last purchase date is before 31 December 2015.

last_purchase < '2015-12-31'

Expressions can be chained using 'and' and 'or' operators and can be excluded using the 'not' operator.

Read more about fields, operators and values.

Fields

Fields form part of an expression. You can filter on the following fields. Note that fields are only available if data is collected in your store.

Label Field Name Description
Age age Age of customer, if available.
Churn churn_rate Probability (from 0 to 1) that a customer is at risk.
CLV clv Predictive customer lifetime value, the expected present value of future purchases of a customer.
First name first_name First name of a customer.
First signup date first_signup Date that customer registered for store account.
Gender gender M (male) or F (female), if available.
Language language Language choice of a customer.
Last name last_name Last name of a customer.
Last purchase last_purchase Date of most recent purchase.
Last signin date last_signin Date of most recent sign-in.
Lifecycle tag_active Classifies customers into one-time (one_time), active (active), at-risk (at_risk) or lost (lost). A customer is considered active if his churn rate is less than 0.5, at-risk when between 0.5 and 0.9 and lost when more than 0.9.
Number of purchases no_of_purchases Number of purchases a customer to date.
Purchase status tag_purchase Classifies customers into newly registered (new_register) or existing customers (new_customer).
Segment tag_segment Classifies customers into VIP (vip), core (core), customers with potential (potential) and non-core (non_core) customers according to our predictive segmentation algorithm.
Total purchase amount total_purchase Total dollar value of purchases from a customer to date.

Operators

Overview

You can use the arithmetic operators such as equality (=), less than or equal to (<=), more than or equal to (>=), less than (<) and more than (>) to filter customers that meet certain criteria.

Here are a list of operators:

Operator Symbol Description
Equals = Equality.
Equals (case insensitive) ~= Case sensitive equality.
Regex ~~ Checks if field matches regular expression.
Greater than > Strictly greater than.
Greater than or equal >= Greater than or equal to.
Less than < Strictly less than.
Less than or equal <= Less than or equal to.
Contains contains Field contains a certain string.
Contains (case insensitive) ~contains Field contains a certain case-insensitive string.
Starts with startswith Field starts with a certain string.
Starts with (case insensitive) ~startswith Field starts with a certain case-insensitive string.
Ends with endswith Field ends with a certain string.
Ends with (case insensitive) ~endswith Field ends with a certain case-insensitive string.
Is null isnull Field is null.
Chaining Operators

Often, you need to run complex queries that are the result of many expressions. You can chain two or more expressions using logical operators 'and' and 'or'. They work like logical operators in mathematics and you can use parenthesis () to indicate which expressions should be evaluated first.

Not Operator

You can use the 'not' operator to exclude the results of expressions. The 'not' operator appears in front of an expression, like so:

not tag_active = 'active'

The expression above filters customers who are not active.

Values

Values can be strings, numbers or dates.

Strings

Strings should be wrapped with apostrophes (') or double quotes (").

Numbers

Numbers are integers and decimals. They do not have to be wrapped in quotes.

Dates

Metisa supports four types of dates. Dates should be provided in the format below and text should be wrapped with apostrophes (') or double quotes (").

Type Description Format
Date Dates with year (YYYY), month (MM) and day (DD) and no time component. "YYYY-MM-DD"
Naive datetime Date with a time component in hours (HH), minutes (MM) and seconds (SS) but without a timezone component. "YYYY-MM-DDTHH:MM:SS"
Timezone aware datetime Datetime with a specified timezone offset (+hh:mm). "YYYY-MM-DDTHH:MM:SS+hh:mm"
Relative dates Specified number of days (d), weeks (w), months (m) or years (y) prior to today. e.g. {{date:4w}} returns the day 4 weeks prior to today. {{date:2y}}