Clause
A clause can be either an “expression” clause, an “engagement” clause, a “transition” clause, a “cohort membership” clause, or a “connections import” clause. It is essentially a particular condition which must be met in order for a user to enter a cohort. A query is composed from one or more clauses. In the Behavior section of the Custom Cohort builder in the Permutive dashboard, a clause is represented as a single white box containing conditions on a single event type. The image below shows a cohort with two clauses:Expression Clause
An expression clause represents conditions relating to a particular type of event, which must be met in order for the user to fall into the segment. It has the following top level fields:
The ‘football lovers’ query above is an example of an expression clause.
Engagement Clause
An engagement clause selects users based on the time they spend active on-site (engaged time) and their page scroll-depth (completion). It has one of the following top level keys:"engaged_time"- identify users with a total amount of engaged time over a period, regardless of how many pageviews the user has had. For example, users with 120 seconds or more engaged time in the last 7 days across pages about dogs."engaged_completion"- identify users with a specified maximum completion on the current page. For example, users with at least 40% completion on the current page."engaged_views"- identify users who have had distinct page views each with some amount of engaged time or completion. For example, users with 3 or more page views about dogs each with more than 30 seconds’ engaged time.
Here are some examples of engagement clause objects:
Transition Clause
A transition clause selects users based on whether or not they have entered or left another particular cohort. It has one of the following top level keys:"has_entered"- the user has entered the given cohort"has_not_entered"- the user has not entered the given cohort"has_exited"- the user has exited the given cohort"has_not_exited"- the user has not exited the given cohort
Here is an example of a transition clause object:
Cohort Membership Clause
This clause represents the requirement for a user to belong to a given third party (or second party) cohort. It has one of the following top level keys:"in_third_party_segment"- the user is in the given third party cohort"not_in_third_party_segment"- the user is not in the given third party cohort"in_second_party_segment"- the user is in the given second party cohort"not_in_second_party_segment"- the user is not in the given second party cohort
Here are some examples of cohort membership clauses:
Connections Import Clause
A connections import clause matches users based on their membership of a Connectivity import (of either “User Profile” or “User Activity” data). You can optionally apply property filters, restrict the time window, and set frequency constraints. It has one of the following top level keys:"in_connections_import_segment"- the user is in the given connections import segment"not_in_connections_import_segment"- the user is not in the given connections import segment
Filters
The"filters" field defines conditions on properties of the connections import segment. Property names reference the connections import schema directly and do not use the properties. prefix.
A single filter condition:
"and" or "or":
"condition" object uses the same format as described in the "where" section below (string, integer, float, date, boolean, and list conditions are all supported).
Here are some examples of connections import clause objects:
Number Comparison
A ‘number comparison’ object is used in several different cases when a numeric property needs to be measured against a specific condition. The object consists of a single key-value, with the following available options:”during”
This defines the time period during which the conditions must be met in order for a user to enter a cohort. It can be either a single string value, or an object with a single key pointing to a single value or a nested object. Valid values are:
Here are examples of
"during" conditions:
“where”
This defines conditions on properties of a given event which must be met in order for a user to enter a cohort. It consists of an object with two fields:"property"- this is the name of the property on which the condition is tested"condition"- this defines the condition to be tested
Property naming conventions: Property names consist of string segments separated by periods. All properties start with
"properties.", although this is hidden in the Permutive Dashboard. The full name for an event property that appears in the dashboard as client.title would therefore be "properties.client.title"."condition" can be one of the following:
Integer conditionThis is a condition on an integer numeric value. It takes the form of a ‘Number Comparison’ object as described above. Float condition
This is a condition on a floating point numeric value. Its form is exactly the same as a normal ‘number comparison’ object, except that the top level key is prefixed with
float_, for example "float_equal_to", "float_between", etc, and the actual comparison value is interpreted as a floating point number rather than an integer.
Date conditionThis is a condition on a timestamp value. Its form is exactly the same as a normal ‘number comparison’ object, except that the top level key is prefixed with
date_, for example "date_equal_to", "date_between", etc, and the actual comparison value is a string timestamp instead of an integer.
String conditionThis is a condition on a string property. It consists either of a single string value, or an object with a single field. Valid values are:
List condition
This is a condition on a list property. It consists either of a single string value, or an object with a single field. Valid values are:
List summary condition
This is a condition on some aggregation of a property which is a list of objects. It consists of an object with four fields:
- “
property” - the property within the listed objects which is to be aggregated "condition"- the condition to be applied to the specified property"function"- the type of aggregation to perform on the list"where"(optional) - an additional filter to apply to the listed objects before applying the aggregation
Property naming: The
"property" naming convention within a list summary condition is to omit the common prefix. For example, say we have a list summary condition on a property properties.slot.targeting, which is a list of objects with two fields, properties.slot.targeting.key and properties.slot.targeting.value. Within the list summary condition, we would refer to those two properties as key and value respectively, since the first part of the property path is implicit."condition" object takes the same form as the "condition" clause within a normal "where" object (see relevant section above).
The "function" must be one of the following: "any", "all", "sum", "product", “max”, ”min”, ``"count", or "mean". Some of these (sum, product, max, min and mean) can only be used on a numeric sub-property.
The "where" object takes the same form as the "where" component of a top level clause.
An example of a list summary condition is:
This is a condition on a Boolean property. Is consists of an object with a single key,
"boolean_equal_to", and a value of either "true" or "false".
Compound "where" conditions
Anywhere a "where" object is expected, it is also possible to provide a list of multiple conditions separated by either ORs or ANDs. This can only be a single list, and can only be one level deep. For example: