Segment Definition
- Table of Contents
- Any/All
- In Mailing List
- Not In Suppression List
- Subscriber Date Bounced / Confirmed / Subscribed / Unsubscribed / Spam Complained
- In Segment
- Portion
- Subscriber Clicked Link
- Subscriber Confirmed
- Subscriber Domain
- Subscriber Email
- Subscriber Format
- Subscriber in Campaign
- Subscriber near US Zip Code
- Subscriber Opened Campaign/Autoresponder
- Subscriber Clicked Campaign/Autoresponder
- Subscriber Most Recently Opened / Clicked / Sent
- Subscriber Status
- Custom Fields
Segments may be specified in the Campaigns API and the Segments API using the syntax as defined below.
The definition is an array of clauses, all of which must be true for each subscriber record to be included.
Specifying an empty array []
is equivalent to selecting “All Active Subscribers”.
Any/All
Segments support nested logic switches with any
and all
types.
type
string /required |
|
clauses
array of hashes /required |
An array of criteria definitions. |
Example:
{
"type": "any",
"clauses": [
{ "type": "in_mailing_list", "operator": "is_in", "mailing_list_id": 12 },
{
"type": "all",
"clauses": [
{ "type": "in_mailing_list", "operator": "is not in", "mailing_list_id": 13 },
{ "type": "in_mailing_list", "operator": "is not in", "mailing_list_id": 15 },
]
}
]
}
The above example will select all subscribers who are either in mailing list id #12 or are not in mailing list id #13 or #15.
In Mailing List
The segment may include a rule restricting the included subscribers to those whose email addresses exist on another mailing list.
type
string /required |
|
||||||||
operator
string /required
|
|||||||||
mailing_list
hash /required If both an
|
|||||||||
mailing_list_id
integer /deprecated |
The |
Example:
{
"type": "in_mailing_list",
"operator": "is_in",
"mailing_list": { "id": 12 }
}
This campaign would be sent to “All Active Subscribers whose email addresses exist on mailing list #12”.
Not In Suppression List
The segment may include a rule restricting the included subscribers to those whose email addresses is not matched by a specific suppression list.
type
string /required |
|
||||
suppression_list
hash /required If both an
|
Example:
{
"type": "not_in_suppression_list",
"suppression_list": { "id": 12 }
}
This campaign would be sent to “All Active Subscribers whose email addresses are not suppressed by suppression list #12”.
Subscriber Date Bounced / Confirmed / Subscribed / Unsubscribed / Spam Complained
These rules all have similar structures and functions, the only difference being the segment’s type
field.
type
string /required |
|
||||||||||||||||
operator
string /required
|
|||||||||||||||||
number_of_days
integer |
The integer number of days to search for
|
||||||||||||||||
date
string |
A string which can be parsed to a date field. See Dates and Times.
|
||||||||||||||||
date_range
hash
|
Example #1:
{
"type": "subscriber_date_bounced",
"operator": "not_in_the_last_days",
"number_of_days": 5
}
Example #2:
{
"type": "subscriber_date_subscribed",
"operator": "on_or_before",
"date": "2015-09-01"
}
Example #3:
{
"type": "subscriber_date_spam_complained",
"operator": "between",
"date_range": { "start": "2015-09-01", "end": "2015-09-03" }
}
In Segment
Find subscribers based on whether they match an existing segment.
type
string |
|
||||
operator
string
|
|||||
segmentation_criteria
hash If both an
|
Example:
{
"type": "in_segmentation_criteria",
"operator": "is_in",
"segmentation_criteria": {
"id": 456,
"name": "Active Subscribers"
}
}
Portion
Send to only a portion of your list based on percentages.
For example, send one email to 0%
-10%
of your list,
send a second email to 10%
-20%
of your list (keeping the same randomization key),
then send the more successful of the two emails to 20%
-100%
of your list as a way to do A/B split testing on a campaign. In this example,
no subscriber will be sent two emails because there are no overlapping
percentage/randomization key combinations.
Portion clauses accept the following fields:
type
string |
|
lower
integer /required |
The lower number of the range of percentages to segment on within your mailing list. May contain up to 2 decimals of precision.
|
upper
integer /required |
The greater number of the range of percentages to segment on within your mailing list. May contain up to 2 decimals of precision. When this number is less than 100, it will be used as an exclusive (not
included) limit. When this number equals 100, it is an inclusive limit.
This causes
|
key
string |
The randomization key will act as a salt for sorting your mailing list.
When creating multiple If no key is specified, one will be generated for you.
|
Example:
{
"type": "portion",
"lower": 0,
"upper": 47,
"key": "my_randomized_key"
}
Subscriber Clicked Link
Find subscribers who have clicked a specific link within a campaign or autoresponder.
If no link is specified then subscribers who clicked any link within the campaign/autoresponder are selected.
type
string /required |
|
||||
operator
string /required
|
|||||
campaign
hash /optional If both an Either
|
|||||
autoresponder
hash /optional If both an Either
|
|||||
link
hash /default: Leave If both an
|
Example:
{
"type": "subscriber_clicked_link",
"operator": "has_clicked_on",
"campaign": {
"id": 19
},
"link": {
"id": 19
}
}
Subscriber Confirmed
Find subscribers who have or haven’t clicked confirmation links.
This rule is only valid if the system has the confirmed field enabled and the mailing list has it turned on.
type
string |
|
confirmed
boolean |
Select users that have confirmed or not confirmed. |
Example:
{
"type": "subscriber_confirmed",
"confirmed": true
}
Subscriber Domain
Find subscribers based on their email address’ domain.
type
string |
|
||||||||
operator
string
|
|||||||||
domains
array of strings |
The list of domains to compare against. |
Example:
{
"type": "subscriber_domain",
"operator": "is_one_of",
"domains": [ "gmail.com", "yahoo.com" ]
}
Subscriber Email
Find subscribers based on their email addresses.
type
string |
|
||||||||||||
operator
string All of the following email address comparisons are case-insensitive:
|
|||||||||||||
value
string |
The string value to use when comparing email addresses. |
Example:
{
"type": "subscriber_email",
"operator": "contains",
"value": "postmaster"
}
Subscriber Format
Find subscribers based on their preferred email format.
This rule is only valid if the mailing list has the format field enabled.
type
string |
|
||||
operator
string
|
|||||
format
string |
The |
Example:
{
"type": "subscriber_format",
"operator": "is",
"format": "html"
}
Subscriber in Campaign
Find subscribers based on whether they were sent a campaign.
type
string |
|
||||
operator
string
|
|||||
campaign
hash Setting If both an
|
Example:
{
"type": "subscriber_in_campaign",
"operator": "was_not_included",
"campaign": {
"id": 4912
}
}
Subscriber near US Zip Code
Find subscribers who are more or less than a certain distance from a given zip_code
.
You must have a text or number custom field already set up which will be interpreted as the subscriber’s zip_code
.
type
string |
|
||||
operator
string
|
|||||
distance_in_miles
integer |
The distance in miles to include or exclude subscribers around the given |
||||
zip_code
string |
The zip code to base your search off of. This value can be formatted as |
||||
zip_code_custom_field
hash If both
|
|||||
include_blank_values
boolean |
Include subscribers with an empty value in their
|
Example:
{
"type": "subscriber_near_us_zip_code",
"operator": "is_not_within",
"distance_in_miles": 50,
"zip_code": "04401",
"zip_code_custom_field": {
"name": "Zip Code"
},
"include_blank_values": true
}
Subscriber Opened Campaign/Autoresponder
Find subscribers based on whether they opened a campaign or autoresponder.
type
string |
|
||||
operator
string
|
|||||
campaign
hash Setting both Only one of If both an
|
|||||
autoresponder
hash Setting both Only one of If both an
|
|||||
privacy_status
string |
Valid values include: Limit the open events that are searched to only match on any, privacy, or non-privacy opens. Because Apple’s Mail Privacy Protection stops triggering privacy opens when mail is delivered to the bulk folder, it can be useful in various situations to match on a variety of open types. Non-privacy opens tell you that a subscriber actually opened the email. Privacy opens tell you that the email reached the inbox. |
Example:
{
"type": "subscriber_opened_campaign",
"operator": "has_not_opened",
"campaign": {
"id": 491
},
"privacy_status": "non-privacy"
}
Subscriber Clicked Campaign/Autoresponder
Find subscribers based on whether they clicked a campaign or autoresponder.
type
string |
|
||||
operator
string
|
|||||
campaign
hash Setting both Only one of If both an
|
|||||
autoresponder
hash Setting both Only one of If both an
|
Example:
{
"type": "subscriber_clicked_campaign",
"operator": "has_not_clicked",
"campaign": {
"id": 491
}
}
Subscriber Most Recently Opened / Clicked / Sent
Find subscribers based on their most recent open, click, or send.
type
string |
|
||||||||||||||||
operator
string
|
|||||||||||||||||
number_of_days
integer |
The integer number of days to search for Required for operators: |
||||||||||||||||
date
string |
A string which can be parsed to a date field. See Dates and Times. Required for operators: |
||||||||||||||||
date_range
hash Required for operator:
|
|||||||||||||||||
privacy_status
string |
This field is only valid when Valid values include: Limit the open events that are searched to only match on any, privacy, or non-privacy opens. Because Apple’s Mail Privacy Protection stops triggering privacy opens when mail is delivered to the bulk folder, it can be useful in various situations to match on a variety of open types. Non-privacy opens tell you that a subscriber actually opened the email. Privacy opens tell you that the email reached the inbox. |
Example #1:
{
"type": "subscriber_opened",
"operator": "not_in_the_last_days",
"number_of_days": 5,
"privacy_status": "any"
}
Example #2:
{
"type": "subscriber_clicked",
"operator": "on_or_before",
"date": "2015-09-01"
}
Example #3:
{
"type": "subscriber_sent",
"operator": "between",
"date_range": { "start": "2015-09-01", "end": "2015-09-03" }
}
Subscriber Status
Find subscribers which do or do not have the given status.
type
string |
|
||||
operator
string
|
|||||
status
string |
|
Example:
{
"type": "subscriber_status",
"operator": "is_not",
"status": "active"
}
Custom Fields
Here are two example custom field criteria:
[
{ "type": "subscriber_custom_field", "name": "Age", "operator": "is_greater_than", "value": 20 },
{ "type": "subscriber_custom_field", "name": "Membership", "operator": "contains", "value": "newsletter" }
]
The above matches subscribers that are over 20 years of Age
and have the “newsletter” Membership
.
Each custom field has a list of operators that define how to match subscribers using the specified custom field. See the tables below for a listing of what operators each kind of custom field supports.
Text Fields
The following operators apply to both text
and text_multiline
custom fields:
contains |
The given
|
does_not_contain |
The given
|
is |
The given
|
is_not |
The given
|
is_not_set |
The custom field has no value. This may either be because it has
never been set or it was set to
|
begins_with |
The custom field begins with the given
|
ends_with |
The custom field ends with the given
|
Boolean Fields
The following operators apply to boolean
custom fields:
true |
The custom field is set to true.
|
false |
The custom field is either set to false or has no value.
|
Date Fields
The following operators apply to date
custom fields:
before |
The custom field is set equal to a date before the specified
|
after |
The custom field is set equal to a date after the specified
|
between |
The custom field is between the
|
is_not_set |
The custom field has no date set.
|
in_the_last_days |
The custom field is sometime in the last For example, if the example clause below is evaluated on
|
not_in_the_last_days |
The custom field is not sometime in the last For example, if the example clause below is evaluated on
|
Day of Year Fields
The following operators apply to day_of_year
custom fields:
before |
Find subscribers who have the custom field set to a value that’s
earlier in the year than the specified The
|
after |
Find subscribers who have the custom field set to a value that’s
later in the year than the specified The
|
between |
Find subscribers who have the custom field set to a value that’s
equal to or between the specified The
|
is_not_set |
The custom field has no day of year set.
|
on |
The custom field is the specified The
|
Number Fields
The following operators apply to number
custom fields:
equals |
The given
|
does_not_equal |
The given
|
is_less_than |
The custom field is less than the given
|
is_greater_than |
The custom field is greater than the given
|
is_between |
The custom field is between the
|
is_not_between |
The custom field is not between the
|
is_not_set |
The custom field has no value set.
|
Single Selection Fields
The following operators apply to select_single_dropdown
and select_single_radio
custom fields:
any_of |
The custom field is set to one of the specified values, case insensitive.
|
is_not_set |
The custom field has no value selected.
|
Multiple Selection Fields
The following operators apply to select_multiple_checkboxes
custom fields:
any_of |
The selected custom field options contain at least one of the specified values, case insensitive.
|
all_of |
The selected custom field options contain all of the specified values, case insensitive.
|
none_of |
The selected custom field options contain none of the specified values, case insensitive. Subscribers with no value selected will also be included in this match.
|
is_not_set |
The custom field has no value selected.
|