This guide assumes you have a catalog with your travel inventory ready, and have set up the required travel events on your website and/or in your mobile app, and have associated your catalog with your event sources.
As of September 20, 2018 we will not support subtype
after v3.0 of Marketing API for custom audiences for websites, apps, engagement custom audiences, and audiences from offline conversion data. The one exception is that subtype
will still be supported for engagement custom audiences for video.
Create a travel audience in two steps:
Besides associating your event sources with your catalog, you must also create an event source group. Event source groups are used to fill audiences.
use FacebookAds\Object\EventSourceGroup;
use FacebookAds\Object\Fields\EventSourceGroupFields;
$event_source_group = new EventSourceGroup(null, <BUSINESS_ID>);
$event_source_group->setData(array(
EventSourceGroupFields::NAME => 'My Travel Company Events',
EventSourceGroupFields::EVENT_SOURCES => array(
<PIXEL_ID>,
<APP_ID>,
),
));
$event_source_group->create();
from facebookads.adobjects.eventsourcegroup import EventSourceGroup
event_source_group = EventSourceGroup(parent_id=<BUSINESS_ID>)
event_source_group[EventSourceGroup.Field.name] = 'My Travel Company Events'
event_source_group[EventSourceGroup.Field.event_sources] = [
<PIXEL_ID>,
<APP_ID>,
]
event_source_group.remote_create()
curl \
-F 'name=My Travel Company Events' \
-F 'event_sources=["<PIXEL_ID>","<APP_ID>"]' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v2.11/<BUSINESS_ID>/event_source_groups
You must then share this event source group out to any ad accounts that wish to create an audience backed by it. Again, this is done by making an HTTP POST
call:
use FacebookAds\Object\EventSourceGroup;
$event_source_group = new EventSourceGroup(<EVENT_SOURCE_GROUP_ID>);
// ad account id without 'act_'
$event_source_group->createSharedAccount(array(), array(
'accounts' => array(
'<ACCOUNT_ID_WITHOUT_ACT>',
),
));
from facebookads.adobjects.eventsourcegroup import EventSourceGroup
event_source_group = EventSourceGroup(<EVENT_SOURCE_GROUP_ID>)
# ad account id without 'act_'
response = event_source_group.create_shared_account(
params={
'accounts': ['<ACCOUNT_ID_WITHOUT_ACT>'],
},
)
print(response)
curl \
-F 'accounts=["<ACCOUNT_ID_WITHOUT_ACT>"]' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v2.11/<EVENT_SOURCE_GROUP_ID>/shared_accounts
At this point you should have your user signal (i.e. pixel and/or app events) set-up and associated with an event source group and your travel catalog(s).
To target people whom have shown explicit travel intent, you must create a dynamic travel audience of people who you would like to serve the ad to. You can include and exclude people based on their travel intent signals. You can also apply additional rule-based filters on top of the events like with Website Custom Audiences. The flight_set_id
field is required for a dynamic flight audience. For hotel and destination audiences, you are not required to specify a hotel_set_id
or destination_set_id
.
To set up a new travel audience, make an HTTP POST
to /act_<AD_ACCOUNT_ID>/customaudiences
.
Field & Type | Description |
---|---|
Type: | Required. The objective of the audience. Must be set to |
Type: | Required. Specify the type of signal that should be used to build this audience. Must be set to |
Type: | JSON array of "event_sources": [ { "type": "pixel", "id": "562030684179932" }, { "type": "app", "id": "562030684179934" } ] Required if you do not provide |
Type: | Specify the event source group whose events will back the audience. Required if you don't provide |
Type: | Required. An array of JSON objects listing each intent signal that would make a Accounts Center account eligible for this audience. See Inclusion Object Parameters table below. |
Type: | A further description of the audience. |
Type: | An array of JSON objects listing each intent signal that would exclude an eligible Accounts Center account from this audience. See Exclusion Object Parameters table below. |
Type: | A classical audience rule to be applied to the event stream before any |
Field Name and Type | Description |
---|---|
Type: | Required. The event name of a signal you want to consider for inclusion. Example: |
Type: | Required. The minimum/maximum amount of time since the event was received for it to be considered for purposes of inclusion. The retention window must be at least 4 hours. See Retention Object Parameters table below. Example: |
Type: | Booking window is the time in seconds between the user's checkin date and the current time. You specify a range and only people whose booking window is within this range are included. Negative booking windows are also supported, allowing you to include people whose checkin date has passed. See Booking Window Object Parameters table below. Examples:
|
Type: | The number of times that the event has been fired. You can use both equality and numeric comparison operators here. Examples: |
Field Name and Type | Description |
---|---|
Type: | Required. The maximum amount of time (in seconds) since the event was received. Example: |
Type: | The minimum amount of time (in seconds) since the event was received. Example: |
Field Name and Type | Description |
---|---|
Type: | Required. The minimum amount of time (in seconds) between current date and the desired checkin-date of the user. Example: |
Type: | Required. The maximum amount of time (in seconds) between current date and the desired checkin-date. Example: |
Field Name and Type | Description |
---|---|
Type: | Required. The event name of a signal you want to consider for exclusion. Example: |
type: | Required. The minimum/maximum amount of time since the event was received for it to be considered for purposes of exclusion. The retention window must be at least 4 hours. See Retention Object Parameters table below. Example: |
Just as with the classical parameter, each parameter here can be used with any of the standard JSON
operators.
Field Name and Type | Description |
---|---|
type: | Matches only those events when at least one Only for travel audiences with Example: |
type: | Matches only those events when at least one Only for travel audiences with Example: |
type: | Required for flight ads. Matches only those events when the route ( Only for travel audiences with Example: |
type: | Number of nights spent during the trip. Example: |
type: | Number of weekends between the start and end date Example: |
type: | Total number of travelers
Example: |
Date fields:
type: | Use relevant date fields based on Example: |
type: | Trip contains a specific date. Example: |
Single travelers who have searched at least 3 times in the last 5 days but haven't booked yet:
use FacebookAds\Object\CustomAudience;
use FacebookAds\Object\Fields\CustomAudienceFields;
use FacebookAds\Object\Values\CustomAudienceSubtypeValues;
use FacebookAds\Object\Values\CustomAudienceClaimObjectiveValues;
use FacebookAds\Object\Values\CustomAudienceContentTypeValues;
$custom_audience = new CustomAudience(null, 'act_<AD_ACCOUNT_ID>');
$custom_audience->setData(array(
CustomAudienceFields::NAME => 'Travel Audience',
CustomAudienceFields::SUBTYPE => CustomAudienceSubtypeValues::CLAIM,
CustomAudienceFields::CLAIM_OBJECTIVE =>
CustomAudienceClaimObjectiveValues::TRAVEL,
CustomAudienceFields::CONTENT_TYPE => CustomAudienceContentTypeValues::HOTEL,
CustomAudienceFields::EVENT_SOURCE_GROUP => <EVENT_SOURCE_GROUP_ID>,
CustomAudienceFields::RULE => array(
'num_travelers' => array('eq' => 1),
),
'inclusions' => array(
array(
'event' => 'Search',
'count' => array('gt' => 3),
'retention' => array('min_seconds'=> 0, 'max_seconds'=> 432000),
),
),
'exclusions' => array(
array(
'event' => 'Purchase',
'retention' => array('min_seconds'=> 0, 'max_seconds'=> 172800),
),
),
));
$custom_audience->create();
from facebookads.adobjects.customaudience import CustomAudience
audience = CustomAudience(parent_id='act_<AD_ACCOUNT_ID>')
audience[CustomAudience.Field.name] = 'Travel Audience'
audience[CustomAudience.Field.subtype] = CustomAudience.Subtype.claim
audience[CustomAudience.Field.claim_objective] = \
CustomAudience.ClaimObjective.travel
audience[CustomAudience.Field.content_type] = CustomAudience.ContentType.hotel
audience[CustomAudience.Field.event_source_group] = <EVENT_SOURCE_GROUP_ID>
audience[CustomAudience.Field.rule] = {
'num_travelers': {'eq': 1},
}
audience['inclusions'] = [
{
'event': 'Search',
'count': {'gt': 3},
'retention': {'min_seconds': 0, 'max_seconds': 432000},
},
]
audience['exclusions'] = [
{
'event': 'Purchase',
'retention': {'min_seconds': 0, 'max_seconds': 432000},
},
]
audience.remote_create()
curl \
-F 'name=Travel Audience' \
-F 'subtype=CLAIM' \
-F 'claim_objective=TRAVEL' \
-F 'content_type=HOTEL' \
-F 'event_source_group=<EVENT_SOURCE_GROUP_ID>' \
-F 'rule={"num_travelers":{"eq":1}}' \
-F 'inclusions=[
{
"event": "Search",
"count": {"gt":3},
"retention": {"min_seconds":0,"max_seconds":432000}
}
]' \
-F 'exclusions=[{"event":"Purchase","retention":{"min_seconds":0,"max_seconds":172800}}]' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/customaudiences
People who viewed or started booking a hotel in a hotel set in the last 2 days but never completed their booking:
use FacebookAds\Object\CustomAudience;
use FacebookAds\Object\Fields\CustomAudienceFields;
use FacebookAds\Object\Values\CustomAudienceSubtypeValues;
use FacebookAds\Object\Values\CustomAudienceClaimObjectiveValues;
use FacebookAds\Object\Values\CustomAudienceContentTypeValues;
$custom_audience = new CustomAudience(null, 'act_<AD_ACCOUNT_ID>');
$custom_audience->setData(array(
CustomAudienceFields::NAME => 'Travel Audience',
CustomAudienceFields::SUBTYPE => CustomAudienceSubtypeValues::CLAIM,
CustomAudienceFields::CLAIM_OBJECTIVE =>
CustomAudienceClaimObjectiveValues::TRAVEL,
CustomAudienceFields::CONTENT_TYPE => CustomAudienceContentTypeValues::HOTEL,
CustomAudienceFields::EVENT_SOURCE_GROUP => <EVENT_SOURCE_GROUP_ID>,
CustomAudienceFields::RULE => array(
'hotel_set_id' => array('eq' => <HOTEL_SET_ID>),
),
'inclusions' => array(
array(
'event' => 'ViewContent',
'retention' => array('min_seconds'=> 0, 'max_seconds'=> 172800),
),
array(
'event' => 'InitiateCheckout',
'retention' => array('min_seconds'=> 0, 'max_seconds'=> 172800),
),
),
'exclusions' => array(
array(
'event' => 'Purchase',
'retention' => array('min_seconds'=> 0, 'max_seconds'=> 172800),
),
),
));
$custom_audience->create();
from facebookads.adobjects.customaudience import CustomAudience
audience = CustomAudience(parent_id='act_<AD_ACCOUNT_ID>')
audience[CustomAudience.Field.name] = 'Travel Audience'
audience[CustomAudience.Field.subtype] = CustomAudience.Subtype.claim
audience[CustomAudience.Field.claim_objective] = \
CustomAudience.ClaimObjective.travel
audience[CustomAudience.Field.content_type] = CustomAudience.ContentType.hotel
audience[CustomAudience.Field.event_source_group] = <EVENT_SOURCE_GROUP_ID>
audience[CustomAudience.Field.rule] = {
'hotel_set_id': {'eq': <HOTEL_SET_ID>},
}
audience['inclusions'] = [
{
'event': 'ViewContent',
'retention': {'min_seconds': 0, 'max_seconds': 172800},
},
{
'event': 'InitiateCheckout',
'retention': {'min_seconds': 0, 'max_seconds': 172800},
},
]
audience['exclusions'] = [
{
'event': 'Purchase',
'retention': {'min_seconds': 0, 'max_seconds': 172800},
},
]
audience.remote_create()
curl \
-F 'name=Travel Audience' \
-F 'subtype=CLAIM' \
-F 'claim_objective=TRAVEL' \
-F 'content_type=HOTEL' \
-F 'event_source_group=<EVENT_SOURCE_GROUP_ID>' \
-F 'rule={"hotel_set_id":{"eq":"<HOTEL_SET_ID>"}}' \
-F 'inclusions=[
{"event":"ViewContent","retention":{"min_seconds":0,"max_seconds":172800}},
{
"event": "InitiateCheckout",
"retention": {"min_seconds":0,"max_seconds":172800}
}
]' \
-F 'exclusions=[{"event":"Purchase","retention":{"min_seconds":0,"max_seconds":172800}}]' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v2.10/act_<AD_ACCOUNT_ID>/customaudiences
People who have initiated check out or purchased the flight tickets in the last 5 days and their flight booking window is between 2 to 7 days:
use FacebookAds\Object\CustomAudience;
use FacebookAds\Object\Fields\CustomAudienceFields;
use FacebookAds\Object\Values\CustomAudienceSubtypeValues;
use FacebookAds\Object\Values\CustomAudienceClaimObjectiveValues;
use FacebookAds\Object\Values\CustomAudienceContentTypeValues;
$custom_audience = new CustomAudience(null, 'act_<AD_ACCOUNT_ID>');
$custom_audience->setData(array(
CustomAudienceFields::NAME => 'Travel Audience',
CustomAudienceFields::SUBTYPE => CustomAudienceSubtypeValues::CLAIM,
CustomAudienceFields::CLAIM_OBJECTIVE =>
CustomAudienceClaimObjectiveValues::TRAVEL,
CustomAudienceFields::CONTENT_TYPE => CustomAudienceContentTypeValues::FLIGHT,
CustomAudienceFields::EVENT_SOURCE_GROUP => <EVENT_SOURCE_GROUP_ID>,
'inclusions' => array(
array(
'event' => 'InitiateCheckout',
'retention' => array('min_seconds'=> 0, 'max_seconds'=> 432000),
'booking_window' => array('min_seconds'=> 172800, 'max_seconds'=> 604800),
),
array(
'event' => 'Purchase',
'retention' => array('min_seconds'=> 0, 'max_seconds'=> 432000),
'booking_window' => array('min_seconds'=> 172800, 'max_seconds'=> 604800),
),
),
));
$custom_audience->create();
from facebookads.adobjects.customaudience import CustomAudience
audience = CustomAudience(parent_id='act_<AD_ACCOUNT_ID>')
audience[CustomAudience.Field.name] = 'Travel Audience'
audience[CustomAudience.Field.subtype] = CustomAudience.Subtype.claim
audience[CustomAudience.Field.claim_objective] = \
CustomAudience.ClaimObjective.travel
audience[CustomAudience.Field.content_type] = CustomAudience.ContentType.flight
audience[CustomAudience.Field.event_source_group] = <EVENT_SOURCE_GROUP_ID>
audience['inclusions'] = [
{
"event": "InitiateCheckout",
"retention": {"min_seconds": 0, "max_seconds": 432000},
"booking_window": {"min_seconds": 172800, "max_seconds": 604800},
},
{
"event": "Purchase",
"retention": {"min_seconds": 0, "max_seconds": 432000},
"booking_window": {"min_seconds": 172800, "max_seconds": 604800},
},
]
audience.remote_create()
curl \
-F 'name=Travel Audience' \
-F 'subtype=CLAIM' \
-F 'claim_objective=TRAVEL' \
-F 'content_type=FLIGHT' \
-F 'event_source_group=<EVENT_SOURCE_GROUP_ID>' \
-F 'inclusions=[
{
"event": "InitiateCheckout",
"retention": {"min_seconds":0,"max_seconds":432000},
"booking_window": {"min_seconds":172800,"max_seconds":604800}
},
{
"event": "Purchase",
"retention": {"min_seconds":0,"max_seconds":432000},
"booking_window": {"min_seconds":172800,"max_seconds":604800}
}
]' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/customaudiences
People who have searched hotels in 'New York City' more than 3 times in the past 2 days but haven't booked yet:
use FacebookAds\Object\CustomAudience;
use FacebookAds\Object\Fields\CustomAudienceFields;
use FacebookAds\Object\Values\CustomAudienceSubtypeValues;
use FacebookAds\Object\Values\CustomAudienceClaimObjectiveValues;
use FacebookAds\Object\Values\CustomAudienceContentTypeValues;
$custom_audience = new CustomAudience(null, 'act_<AD_ACCOUNT_ID>');
$custom_audience->setData(array(
CustomAudienceFields::NAME => 'Travel Audience',
CustomAudienceFields::SUBTYPE => CustomAudienceSubtypeValues::CLAIM,
CustomAudienceFields::CLAIM_OBJECTIVE =>
CustomAudienceClaimObjectiveValues::TRAVEL,
CustomAudienceFields::CONTENT_TYPE => CustomAudienceContentTypeValues::HOTEL,
CustomAudienceFields::EVENT_SOURCE_GROUP => <EVENT_SOURCE_GROUP_ID>,
CustomAudienceFields::RULE => array(
'destination' => array('i_contains' => 'New York City'),
),
'inclusions' => array(
array(
'event' => 'Search',
'count' => array('gt' => 3),
'retention' => array('min_seconds'=> 0, 'max_seconds'=> 172800),
),
),
'exclusions' => array(
array(
'event' => 'Purchase',
'retention' => array('min_seconds'=> 0, 'max_seconds'=> 172800),
),
),
));
$custom_audience->create();
from facebookads.adobjects.customaudience import CustomAudience
audience = CustomAudience(parent_id='act_<AD_ACCOUNT_ID>')
audience[CustomAudience.Field.name] = 'Travel Audience'
audience[CustomAudience.Field.subtype] = CustomAudience.Subtype.claim
audience[CustomAudience.Field.claim_objective] = \
CustomAudience.ClaimObjective.travel
audience[CustomAudience.Field.content_type] = CustomAudience.ContentType.hotel
audience[CustomAudience.Field.event_source_group] = <EVENT_SOURCE_GROUP_ID>
audience[CustomAudience.Field.rule] = {
'destination': {'i_contains': 'New York City'},
}
audience['inclusions'] = [
{
'event': 'Search',
'count': {'gt': 3},
'retention': {'min_seconds': 0, 'max_seconds': 172800},
},
]
audience['exclusions'] = [
{
'event': 'Purchase',
'retention': {'min_seconds': 0, 'max_seconds': 172800},
},
]
audience.remote_create()
curl \
-F 'name=Travel Audience' \
-F 'subtype=CLAIM' \
-F 'claim_objective=TRAVEL' \
-F 'content_type=HOTEL' \
-F 'event_source_group=<EVENT_SOURCE_GROUP_ID>' \
-F 'rule={"destination":{"i_contains":"New York City"}}' \
-F 'inclusions=[
{
"event": "Search",
"count": {"gt":3},
"retention": {"min_seconds":0,"max_seconds":172800}
}
]' \
-F 'exclusions=[{"event":"Purchase","retention":{"min_seconds":0,"max_seconds":172800}}]' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/customaudiences
People who have searched hotels between specific checkin_date
and checkout_date
in the past 2 days but haven't booked yet:
use FacebookAds\Object\CustomAudience;
use FacebookAds\Object\Fields\CustomAudienceFields;
use FacebookAds\Object\Values\CustomAudienceSubtypeValues;
use FacebookAds\Object\Values\CustomAudienceClaimObjectiveValues;
use FacebookAds\Object\Values\CustomAudienceContentTypeValues;
$custom_audience = new CustomAudience(null, 'act_<AD_ACCOUNT_ID>');
$custom_audience->setData(array(
CustomAudienceFields::NAME => 'Travel Audience',
CustomAudienceFields::SUBTYPE => CustomAudienceSubtypeValues::CLAIM,
CustomAudienceFields::CLAIM_OBJECTIVE =>
CustomAudienceClaimObjectiveValues::TRAVEL,
CustomAudienceFields::CONTENT_TYPE => CustomAudienceContentTypeValues::HOTEL,
CustomAudienceFields::EVENT_SOURCE_GROUP => <EVENT_SOURCE_GROUP_ID>,
CustomAudienceFields::RULE => array(
'and' => array(
array(
'checkin_date' => array(
'gte' => (new \DateTime("+3 day"))->format('Y-m-d')
),
),
array(
'checkout_date' => array(
'lte' => (new \DateTime("+6 day"))->format('Y-m-d')
),
),
),
),
'inclusions' => array(
array(
'event' => 'Search',
'retention' => array('min_seconds'=> 0, 'max_seconds'=> 172800),
),
),
'exclusions' => array(
array(
'event' => 'Purchase',
'retention' => array('min_seconds'=> 0, 'max_seconds'=> 172800),
),
),
));
$custom_audience->create();
from facebookads.adobjects.customaudience import CustomAudience
import datetime
audience = CustomAudience(parent_id='act_<AD_ACCOUNT_ID>')
audience[CustomAudience.Field.name] = 'Travel Audience'
audience[CustomAudience.Field.subtype] = CustomAudience.Subtype.claim
audience[CustomAudience.Field.claim_objective] = \
CustomAudience.ClaimObjective.travel
audience[CustomAudience.Field.content_type] = CustomAudience.ContentType.hotel
audience[CustomAudience.Field.event_source_group] = <EVENT_SOURCE_GROUP_ID>
audience[CustomAudience.Field.rule] = {
'and': [
{
"checkin_date": {
"gte": str(datetime.date.today() + datetime.timedelta(days=3)),
},
},
{
"checkout_date": {
"gte": str(datetime.date.today() + datetime.timedelta(days=6)),
},
},
],
}
audience['inclusions'] = [
{
'event': 'Search',
'retention': {'min_seconds': 0, 'max_seconds': 172800},
},
]
audience['exclusions'] = [
{
'event': 'Purchase',
'retention': {'min_seconds': 0, 'max_seconds': 172800},
},
]
audience.remote_create()
curl \
-F 'name=Travel Audience' \
-F 'subtype=CLAIM' \
-F 'claim_objective=TRAVEL' \
-F 'content_type=HOTEL' \
-F 'event_source_group=<EVENT_SOURCE_GROUP_ID>' \
-F 'rule={
"and": [
{"checkin_date":{"gte":"2018-02-02"}},
{"checkout_date":{"lte":"2018-02-05"}}
]
}' \
-F 'inclusions=[{"event":"Search","retention":{"min_seconds":0,"max_seconds":172800}}]' \
-F 'exclusions=[{"event":"Purchase","retention":{"min_seconds":0,"max_seconds":172800}}]' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/customaudiences
People who have searched hotel stays containing a specific date (e.g. Christmas) in the past 2 days but haven't booked yet:
use FacebookAds\Object\CustomAudience;
use FacebookAds\Object\Fields\CustomAudienceFields;
use FacebookAds\Object\Values\CustomAudienceSubtypeValues;
use FacebookAds\Object\Values\CustomAudienceClaimObjectiveValues;
use FacebookAds\Object\Values\CustomAudienceContentTypeValues;
$custom_audience = new CustomAudience(null, 'act_<AD_ACCOUNT_ID>');
$custom_audience->setData(array(
CustomAudienceFields::NAME => 'Travel Audience',
CustomAudienceFields::SUBTYPE => CustomAudienceSubtypeValues::CLAIM,
CustomAudienceFields::CLAIM_OBJECTIVE =>
CustomAudienceClaimObjectiveValues::TRAVEL,
CustomAudienceFields::CONTENT_TYPE => CustomAudienceContentTypeValues::HOTEL,
CustomAudienceFields::EVENT_SOURCE_GROUP => <EVENT_SOURCE_GROUP_ID>,
CustomAudienceFields::RULE => array(
'itinerary_contains_date' => array(
'eq' => (new \DateTime())->setDate(Date('Y'), 12, 25)->format('Y-m-d')
),
),
'inclusions' => array(
array(
'event' => 'Search',
'retention' => array('min_seconds'=> 0, 'max_seconds'=> 172800),
),
),
'exclusions' => array(
array(
'event' => 'Purchase',
'retention' => array('min_seconds'=> 0, 'max_seconds'=> 172800),
),
),
));
$custom_audience->create();
from facebookads.adobjects.customaudience import CustomAudience
import datetime
audience = CustomAudience(parent_id='act_<AD_ACCOUNT_ID>')
audience[CustomAudience.Field.name] = 'Travel Audience'
audience[CustomAudience.Field.subtype] = CustomAudience.Subtype.claim
audience[CustomAudience.Field.claim_objective] = \
CustomAudience.ClaimObjective.travel
audience[CustomAudience.Field.content_type] = CustomAudience.ContentType.hotel
audience[CustomAudience.Field.event_source_group] = <EVENT_SOURCE_GROUP_ID>
audience[CustomAudience.Field.rule] = {
"itinerary_contains_date": {
"eq": str(datetime.date(datetime.date.today().year, 12, 25)),
},
}
audience['inclusions'] = [
{
'event': 'Search',
'retention': {'min_seconds': 0, 'max_seconds': 172800},
},
]
audience['exclusions'] = [
{
'event': 'Purchase',
'retention': {'min_seconds': 0, 'max_seconds': 172800},
},
]
audience.remote_create()
curl \
-F 'name=Travel Audience' \
-F 'subtype=CLAIM' \
-F 'claim_objective=TRAVEL' \
-F 'content_type=HOTEL' \
-F 'event_source_group=<EVENT_SOURCE_GROUP_ID>' \
-F 'rule={"itinerary_contains_date":{"eq":"2018-12-25"}}' \
-F 'inclusions=[{"event":"Search","retention":{"min_seconds":0,"max_seconds":172800}}]' \
-F 'exclusions=[{"event":"Purchase","retention":{"min_seconds":0,"max_seconds":172800}}]' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/customaudiences
People who create an audience for one-way flights:
curl \ -F 'name=Travel Audience' \ -F 'claim_objective=TRAVEL' \ -F 'content_type=FLIGHT' \ -F 'event_source_group=<EVENT_SOURCE_GROUP_ID>' \ -F 'rule={"and":[{"returning_departure_date":{"exists":false]}}' \ -F 'inclusions=[ { "event": "Search", "count": {"gt":3}, "retention": {"min_seconds":0,"max_seconds":432000} } ]' \ -F 'exclusions=[{"event":"Purchase","retention":{"min_seconds":0,"max_seconds":172800}}]' \ -F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/customaudiences
Once you have created your audience(s), they can then be added to the targeting spec in your travel ads campaign.