Understanding Lytics / Product Documentation / 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.


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, Dash, or any other name that has the letters "ash" next to each other will be matched.

Date User Fields

custom rule condition builder date relative

Date user fields are commonly used for any data the 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.


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.


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.

case3 interacting rules

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. This dynamic User Field is called a key. Using Events By Device example, the keys may include Desktop, iOS, or Android. Since these keys are dynamic, if in the future a user is tracked using a new device (such as a Chromebook), the new device will automatically be added as a key.

Building the Condition

Custom Rule Condition Builder Map Value

Once a key is selected a condition is built. This will look familiar. Since map user fields can have any type of user field nested within it, the appearance of this step will vary. The type of the nested user field is called the value type. In the case of Events By Device. The value type is numeric and therefore normal numeric user Field behavior applies.


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 at 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.