Event segmentation
Event Segmentation lets you target audiences based on lifecycle actions or Custom Events that have occurred.
To Segment based on event activity, include an Activity Object in your audience, and an optional Where Object to filter on specific event properties.
Activity audience object
The activity object defines the target audience based on lifecycle actions or Custom Event activity, using comparison operators on activity count and recency. Optionally include a where object, which filters for specific activity values.
In the example to the right, the target audience is users who have opened your app from a notification from the “neowise” campaign at least twice, 3 days ago.
OBJECT PROPERTIES- activity stringREQUIRED
The target event activity, e.g.,
app_open.Default event values are enumerated below. If you create a custom or predefined event that you wish to segment users on, you must register the event in the Airship dashboard. See Manage events.
Possible values:
app_open,message_received,message_center_read,message_center_delivered,message_center_deleted,in_app_message_display,in_app_message_resolution,in_app_message_expiration,screen_view,web_session,web_click,short_link_click,first_seen,sms_aborted,sms_delivered,sms_dispatched,sms_expired,sms_failed,sms_rejected,sms_undeliverable,sms_unknown,email_bounce,email_click,email_delay,email_delivered,email_injection,email_open,email_unsubscribe,scene_displayed,scene_completed,scene_incomplete,survey_displayed,survey_submitted,survey_not_submitted - after object
A date value for an absolute comparison or an integer value for a relative comparison.
One of- string
A date-time, for example:
"after": "2020-08-01T12:00:00".
- before object
A date value for an absolute comparison or an integer value for a relative comparison.
One of- string
A date-time, for example:
"before": "2020-08-01T12:00:00".
- metric string
The metric you are targeting for the event.
When using the metric
countortotal_value,operatorandvalueare required.When using either
firstorlast,operatorandvalueare not allowed. Use one of the following combinations instead:before/precisionafter/precisionon/on_precision
Metric Description countEvaluate based on the number of event occurrences. total_valueEvaluate based on the cumulative event valueassociated with the target user.lastEvaluate based on the last occurrence of an event for a given user/time window. firstEvaluate based on the first occurrence of an event for a given user/time window. Possible values:
count,total_value,last,first - on string
Use
onin conjunction with thefirstorlastmetric to indicate either a specific date or period with precision. Use either:- A date in ISO 8601 format, e.g.,
2020-08-10T17:28:34+0000or - An integer that, when combined with the
on_precisionproperty, specifies the time period. For example, use"on": 12with"on_precision: "month"to target events that occurred in December.
- string
A date-time.
- A date in ISO 8601 format, e.g.,
- on_precision string
When using the
firstorlastmetric with theonproperty to target events on. For example, for the 5th of any month, or only in March, useon_precision.Possible values:
day,month,month_day,year_month,year_month_day - operator stringREQUIRED
The comparison operator used to evaluate the activity expression. Use these operators (greater/less than, equal to, equal or greater/equal or less) when the
metricis eithercountortotal_value.Possible values:
greater,less,equals,greater_eq,less_eq - precision string
If using a relative number (integer) for the
before/after/onproperty, theprecisionvalue will be interpreted as the number of time units ago, e.g., 7 days ago. Defaults todays.Possible values:
days,weeks,months,years - value numberREQUIRED
The value that the
operatoruses to evaluate the target audience. - where object
The Where Object.
Used in:
- Create experiment (A/B Test)
- Create Segment
- Experiment listing
- Experiment lookup
- Push to template
- Schedule a notification
- Schedule a templated push
- Scheduled experiment listing
- Segment lookup
- Send a push
- Subscribe or unsubscribe channels to/from subscription lists
- Update schedule
- Update Segment
- Validate a push
- Validate a template
- Validate experiment
Examples
Activity audience object
{
"audience": {
"activity": "app_open",
"operator": "greater",
"value": 2,
"after": 3,
"precision": "days",
"where": {
"property": "/_triggering_push/campaigns/categories",
"operator": "equals",
"value": "neowise"
}
}
}
Where object
where is an object that filters on the existence of prior user activity, specified by event properties that you provide.
- compare_as string
Selects the property type for comparison.
Possible values:
text,number,date,boolean - operator stringREQUIRED
The operator in question
Possible values:
greater,less,equals,greater_eq,less_eq,contains,present,range,before,after - precision string
Used only for date values.
Possible values:
minutes,days,months,years - property stringREQUIRED
The Custom Event property on which to filter for inclusion in the audience. See Event Segmentation Properties for properties reference.
- relative_to string
Used only for date values.
Possible values:
future,past - value objectREQUIRED
The value of the property you are filtering for in the
One ofwhereobject. Usecompare_asto select the type for comparison.- string
A date-time, e.g.,
2020-08-10T17:28:34+0000.
Examples
Example payload to an audience of users who have opened your app as a result of receiving a specific push ID.
{
"audience": {
"activity": "app_open",
"metric": "count",
"operator": "greater",
"value": 0,
"where": {
"property": "/_triggering_push/push_id",
"operator": "equals",
"compare_as": "text",
"value": "636abb88-5642-4035-998d-a04c93c499ad"
}
},
"device_types": [
"ios", "android"
],
"notification": {
"alert": "Did you get that thing I sent you?"
}
}