rules in inclusions or exclusions.rule: {
"inclusions": <RULE_SET>,
"exclusions": <RULE_SET>,
}
| Name | Description |
|---|---|
inclusionstype: String | Required. Rule Set JSON string that defines the inclusion. See Rule Set Syntax. |
exclusionstype: String | Required. Rule set JSON string that defines the exclusion. See Rule Set Syntax. |
{
"operator" : <BOOLEAN_OPERATOR>,
"rules" : <JSON_RULE>,
}
| Name | Description |
|---|---|
operatortype: string | Required. and or or. |
rulestype: string | Required. JSON string of rules (array of rules). See Inclusion And Exclusion Rule Syntax. |
{
"event_sources" : <EVENT_SOURCE_DEFINITION>,
"retention_seconds" : <SECONDS>,
"filter" : <FILTER>,
"aggregation" : <AGGREGATION>,
}
aggregation and retention_seconds are editable fields. However, editing aggregation and retention_seconds does not flush the audience. People who only match the old rule/aggregation continue to be in the audience until they expire.| Name | Description |
|---|---|
event_sourcestype: String | Required. JSON object containing the id and type.
More event sources can be added to type using a comma delimited list "store_visits,pixel,app". |
retention_secondstype: Integer | Required. Integer (in seconds) for the retention window of the audience, should be less than retention_days. Min=1; Max=365 days |
filtertype: String | Required. JSON string of the filter rules. See Filters. |
aggregationtype: Integer | Optional. JSON string of the aggregation functions. See Aggregate Functions. |
"filter" : {
"operator": <BOOLEAN_OPERATOR>,
"filters": <FILTER_SET>,
}
| Name | Description |
|---|---|
operatortype: string | Required. and or or |
filterstype: string | Required. Array of JSON objects of filter rules. See Filter Set Syntax. |
{
"field": <FIELD>,
"operator": <COMPARISON_OPERATOR>,
"value": <VALUE>,
}
| Name | Description |
|---|---|
fieldtype: String | Required.
|
operatortype: String | Required.
If field set to event, must use =. |
valuetype: String | Required. If the field attribute is set to "event", the value must be set to an event name. Use the App Event API to see app events and parameters reported by the app. |
aggregation in the audience rule field. With this, you define an aggregate function, for example:"aggregation" : {
"type":"count",
"operator":">",
"value":1
}
| Name | Description |
|---|---|
typetype: String | Required. The aggregation function type.
|
config | Required by certain types of aggregation functions. |
methodtype: String | Optional. "absolute", meaning add people that logged events in specified range, or "percentile", meaning add people from a specified percentile range. If you select percentile, the operator should only be in_range and not_in_range. |
fieldtype: String | Required. Unless type is count.The parameter on which the aggregation function is applied. |
operatortype: String | Required. =, !=, >=, >, <=, <, in_range, not_in_range |
valuetype: String | Required. Expected value of the parameter. |
"aggregation" : {
"type":"count",
"operator":">",
"value":1
}
| Operator | Description |
|---|---|
> or gt | True if event’s parameter value greater than specified value. |
>= or gte | True if event’s parameter value greater than or equal to specified value. |
< or lt | True if event’s parameter value less than specified value. |
<= or lte | True if event’s parameter value less than or equal to specified value. |
= or eq | True if event’s parameter value equal to specified value. Note: This is equivalent to not specifying an operator at all; that is, “‘x’ : { ‘eq’ : ‘y’ }” is the same as “‘x’ : ‘y’ }. |
!= or neq | True if event’s parameter value not equal to specified value. |
contains | True if event’s parameter value, as string, contains specified string. Value of “shoe12345” fulfills ‘contains’ if specified value ‘shoe’. |
not_contains | True if event’s parameter value, as string, does not contain specified string. Value “shoe12345” fulfills ‘not_contains’ if specified value is ‘purse’. |
i_contains | Contains, case-insensitive |
i_not_contains | Not contains, case-insensitive |
is_any | True if event’s parameter value matches any strings in given array. |
is_not_any | True if event’s parameter value matches no strings in specified array. |
i_is_any | ‘is_any’, case-insensitive. |
i_is_not_any | ‘is_not_any’, case-insensitive |
starts_with | True is the event’s parameter value starts with the given string |
i_starts_with | “starts_with”, case-insensitive |
regex_match | Matches a regular expression such as "example\.com.*purchase$". The full PCRE grammar is supported |
{
"inclusions": {
"operator": "or",
"rules": [
{
"event_sources": [
{
"type": "pixel",
"id": "<PIXEL_ID>",
}
],
"retention_seconds": 2592000,
"filter": {
"operator": "and",
"filters": [
{
"field": "url",
"operator": "i_contains",
"value": "shoes"
}
]
},
}
]
}
}
ViewContent events where item price is greater than or equal to USD 100 in the last 30 days. Consider using this rule for the following event:_fbq.push([ 'track', 'ViewContent', { productId: 1234, category: 'Men > Shoes', price: 199 } ]);
{
"inclusions": {
"operator": "or",
"rules": [
{
"event_sources": [
{
"type": "pixel",
"id": "<PIXEL_ID>"
}
],
"retention_seconds": 2592000,
"filter": {
"operator": "and",
"filters": [
{
"field": "event",
"operator": "eq",
"value": "ViewContent"
},
{
"operator": "or",
"filters": [
{
"field": "price",
"operator": ">=",
"value": "100"
}
]
}
]
}
}
]
}
}
| Operators | The type of filter |
|---|---|
i_contains | Contains substring, case insensitive |
i_not_contains | Does not contain substring, case insensitive |
contains | Contains substring, case sensitive |
not_contains | Does not contain substring, case sensitive |
eq | Equal to, case sensitive |
neq | Not equal to, case sensitive |
lt | Less than, numeric fields only |
lte | Less than or equal to, numeric fields only |
gt | Greater than, numeric fields only |
gte | Greater than or equal to, numeric fields only |
regex_match | Matches a regular expression such as \"example\\.com.*purchase$\". The full PCRE grammar is supported |
| Data | Data being filtered |
|---|---|
url | Fully escaped URL of the site visited |
domain | Domain of site visited |
path | Path of site visited, excluding domain |
event | Name of pixel event, such as 'ViewContent' |
device_type | Device that accessed site: desktopmobile_android_phonemobile_android_tabletmobile_ipadmobile_ipodmobile_iphonemobile_tabletmobile_windows_phone |
any customData field | Any field added to customData for pixel fires, such as productId, category, price |