How to segment/query users

Segmentation can be done based on user profile attributes and user activity. Here we will talk about user profile attributes.

User attributes can be fixed values (like names, or emails who don’t change) or dynamic, which we’ll compute for you: last visit to site or last purchase value for example.

Users’ segmentation is based on sets of conditions, linked together with AND or OR operators. The AND operator means both left and right conditions (previous and next) are TRUE, and OR means any of the 2 is TRUE.

Each user (and event) attribute is saved in our data warehouse based on it’s type, which cannot be changed. For example:

  • birthdate is a date and can not contain number values or simple text. (same as last visit date for example)
  • lastPurchaseValue is a number and can’t contain text or dates.
  • name is text and it will save exactly as is.
  • isCustomer is of type boolean, which means it can have only 2 values: true or false.

Why is this important? Because based on this type value we will display a list of operators and some value inputs when you save a condition.

Specific cases

When an attribute value doesn’t exists, the system has what it’s called a null value or in usual terms “nothing“. This nothing can only be queried using the is set or is not set condition.

Explaining the most common hurdles:

  • querying for nothing: if you simply want the city of the user to have a value (any value) you use the “IS” operator with “set” or “not set” as value.
  • querying numbers: because numbers can be compared you can use greater than or lower than when doing your comparison.
  • querying texts: you can use include and just enter a portion of the text the value might contain. The entered value is case-sensitive.
  • querying dates: same as numbers you can query for before or after a specific date, or simply use operators X days ago and in the last X days, which are self-explanatory.

Example user segment

Segmentation for users living in Paris who are subscribed to your newsletter:

  • The email needs to exists, so we use “email address” is SET
  • Is subscribed to newsletter should equal True
  • Locality of customer equals Paris.

Hopefully you’ll understand this, as you can play with it to filter any segment of users.


If you segment users based on tags, you can add maximum 1 condition related to tags. Please check how user tags work.

If you add the condition on the same attribute multiple times, the last one will be considered.

Related Articles