Documentation / Product / Features / Audiences / Building Audiences

Building Audiences: Custom Rules

The Custom Rules tab in the audience builder is used to add any rule based on a user field to the audience being built or edited.

Custom Rule Condition Builder User Field List

The user field list displays all the fields in your account. The Source drop-down can be used to filter on the data stream the user field came from. The Includes drop-down can be used to filter user fields on the percentage of users that have a field. Use the Search input to search for a user field by name.

Generally, to add a Custom Rule to an audience definition:

  1. Choose a User Field
  2. Choose an operator (e.g., text contains, value is less than)
  3. Choose a value

There are variations to this general procedure based on the type of the user field and the operator chosen.

Numeric User Fields

Custom Rule Condition Builder Numeric Value

Numeric user fields are most commonly used for data that is counted. For instance, the number of times a visitor has been to a website or the number of times a subscriber has opened an email. Exact values can be matched, but more commonly, inequalities are expressed.


Total Number of Visits must equal 5: Any user who has visited 4 times, 6 times, or any number of times other than 5 will not be matched by this rule.

Total Number of Visits must be less than 3: Any user who has visited 0, 1, or 2 times will be matched by this rule.

Text User Fields

Custom Rule Condition Builder Text Value

Text User fields are commonly used for words and miscellaneous information. For instance, a user’s first name. Since there is no mathematical relationship between two text values, the operations used are generally exact match or partial match.

There are 5 operator options when making audiences with text user fields:

  1. Equal: The value for the field you want the audience to have. Format and character spacing for the value must match exactly what is in the data stream. You can select the value by interacting with the visualization or be promoted with available values by typing into the search bar.
  2. Contain: The text entered (case sensitive and exact order) appears within a value for the field.
  3. Be Like: Use wildcard characters along with text to decide the parts of values you want to match. Note: this currently functions like “Contain.”
  4. Equal one of: Add each, exact value you want included individually. A new search bar will appear after each selection. You can remove values from the list using the “x” to the left of the value. The logic for each of these rules follows the logic from “Equal”.
  5. Exist: Excludes everyone that does not have a value for the field.


First Name must equal Ash: Only users named Ash will be matched.

First name must contain Ash: Any user named Ash will be matched. Additionally, anyone named Ashley, Ashton, or any other name that has the letters "Ash" next to each other will be matched. Dash or Natasha will NOT be matched - as these do not have an “A.” To make an audience that includes these, create a second rule set for “First name must contain ash.”

Date User Fields

custom rule relative date

Date user fields are commonly used for any data that represents a point in time. For instance, the last time a user visited a website. Most commonly, a date is chosen to divide the people who fall before or after that date. You will need to select both your starting point and a direction in time for your custom rule.

Your starting point could be a fixed point in time (useful for milestone events, like product launches) or a relative point in time (useful for scheduled follow ups).

Since each rule only handles going forward or backward from a single point in time, you may need to create two rules that work together to bound a range of time. One rule will capture all dates after the first point in time, and a second rule will capture all dates before a later point in time.

Some date fields have a natural boundary, such as Last Visits, which will never include a date in the future. If you want all Last Visits from a point in time up until now, you would only need to create one rule.


Last Visit must be Before June 22, 2016: Created by selecting Specific Date and the direction Before. This rule includes only users who have not visited since the 22nd of June.

specific data audience

Last Visit must be After 3 days in the past: Created by selecting Relative Date, entering 3 days In the past and selecting the direction After. This rule includes only users who have visited in the last three days.

relative date audience

Subscription End Date must be within the next 30 days: Created by building two rules: one to set the start date to always be the current date and the other to set the end date to 30 days in the future relative to the current date. Create the first rule by selecting Relative Date, After, entering 0 Days, selecting In the past, and clicking Add Condition. Create the second rule by selecting Relative Date, Before, 30 Days, In the future, and clicking Add Condition. This audience will now include all users who have a subscription ending in the next 30 days beginning with the current date.

interacting rules audience

Set User Fields

Custom Rule Condition Builder Set Value

Set user fields are commonly used for collecting related data over time. For instance, all the URLs a user has visited. These fields are generally used much like text user fields, even though the data is structured differently.


All URL Paths Ever must contain one of /blog, /products, or /about: Any user who has visited any one of these three paths will be matched.

Followed Sports must contain Baseball: Any user who follows Baseball will be matched. This is true whether they only follow Baseball or follow Baseball in addition to Football, Hockey, and Bowling.

Map/Nested User Fields

Custom Rule Condition Builder Map Key

Map user fields are used to add hierarchy to a dynamic domain of data. For instance, Events By Device is a count of all events, but grouped by each device. So instead of building a rule by only specifying the count, the rule is built by first specifying the device, then the count. The device could be thought of as an additional, dynamic user field that is nested under the map user field.

Selecting a Key

When using a map user field, the first step is selecting the dynamic user field to build a rule with, called a key. Using the URLs Visited example, the keys could include any numeric value. Since these keys are dynamic, counts will be updated automatically.

Building the Condition


Once a key is selected a condition is built. The type of the nested user field is called the value type. In the case of URLs Visited, the value type is numeric. When building audiences with nested fields, the visualization chart will not display for mapped fields to minimize page load times.


Events By Device (Desktop) must be greater than 5: Only users who have visited the website more than 5 times on a desktop will be matched. If a user has visited more than 5 times on the mobile web, they will not be matched.

Signup Date for Event (Personalization Webinar) must be within the last 7 days: Only the users who signed up for the Personalization Webinar in the last week will be matched. Users who signed up more than 7 days ago will not be matched. Users who signed up for a different event in the last 7 days will also not be matched.


Custom rules allow for ultimate access of all data that is aggregated in user fields. Custom rules are simple statements that can be combined to create very precise audiences. Using them correctly requires a thorough understanding of the data being used, but there is no replacement for this level of segmentation.

When exceeded, the error message "Audience too large! Remove values to save this audience" will be displayed. For example, the following scenarios would trigger the alert:

  • An audience with a single rule that supports multiple values ( e.g. contains one of) with 1001+ values.
  • An audience with 1001+ user field rules each with a single evaluation (e.g. exists).
  • Any variation in between such as two rules each containing over 500 evaluations, etc.