Dynamic Ads for Travel - Creating Ads

You create Dynamic Ads for Travel in much the same way as Dynamic Product Ads.

In this document we describe:

To create a Dynamic Ads for Travel campaign, you must first have:

Every ad at Facebook must be part of ad set which defines its bidding and targeting, and the ad set much be part of a campaign which defines in objective. We must create each level of a campaign in order to run ads.

Step 1. Create Ad Campaign

Dynamic Ads for travel uses the PRODUCT_CATALOG_SALES objective. Make sure you specify a travel catalog in promoted_object at the campaign level:

use FacebookAds\Object\Campaign;
use FacebookAds\Object\Fields\CampaignFields;
use FacebookAds\Object\Values\CampaignObjectiveValues;

$campaign = new Campaign(null, 'act_<AD_ACCOUNT_ID>');
$campaign->setData(array(
  CampaignFields::NAME => 'Product Catalog Sales Campaign',
  CampaignFields::OBJECTIVE => CampaignObjectiveValues::PRODUCT_CATALOG_SALES,
  CampaignFields::PROMOTED_OBJECT => array(
    'product_catalog_id' => <PRODUCT_CATALOG_ID>,
  ),
));

$campaign->create(array(
  Campaign::STATUS_PARAM_NAME => Campaign::STATUS_PAUSED,
));
from facebookads.adobjects.campaign import Campaign

campaign = Campaign(parent_id='act_<AD_ACCOUNT_ID>')
campaign[Campaign.Field.name] = 'Product Catalog Sales Campaign'
objective = Campaign.Objective.product_catalog_sales
campaign[Campaign.Field.objective] = objective
campaign[Campaign.Field.promoted_object] = {
    'product_catalog_id': <PRODUCT_CATALOG_ID>,
}

campaign.remote_create(params={
    'status': Campaign.Status.paused,
})
Campaign campaign = new AdAccount(act_<AD_ACCOUNT_ID>, context).createCampaign()
  .setName("Product Catalog Sales Campaign Group")
  .setObjective(Campaign.EnumObjective.VALUE_PRODUCT_CATALOG_SALES)
  .setPromotedObject("{\"product_catalog_id\":\"" + <PRODUCT_CATALOG_ID> + "\"}")
  .setStatus(Campaign.EnumStatus.VALUE_PAUSED)
  .execute();
String campaign_id = campaign.getId();
curl \
  -F 'name=Product Catalog Sales Campaign' \
  -F 'objective=PRODUCT_CATALOG_SALES' \
  -F 'promoted_object={"product_catalog_id":"<PRODUCT_CATALOG_ID>"}' \
  -F 'status=PAUSED' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.10/act_<AD_ACCOUNT_ID>/campaigns

Step 2. Create Ad Set

Retargeting

After you have a campaign, you create the ad set which defines the bidding and targeting options for your ads.

use FacebookAds\Object\AdSet;
use FacebookAds\Object\Fields\AdSetFields;
use FacebookAds\Object\Fields\TargetingFields;
use FacebookAds\Object\Values\AdSetBillingEventValues;
use FacebookAds\Object\Values\AdSetOptimizationGoalValues;

$adset = new AdSet(null, 'act_<AD_ACCOUNT_ID>');

$adset->setData(array(
  AdSetFields::NAME => 'Product Catalog Sales Adset',
  AdSetFields::BID_AMOUNT => 3000,
  AdSetFields::BILLING_EVENT => AdSetBillingEventValues::IMPRESSIONS,
  AdSetFields::OPTIMIZATION_GOAL =>
    AdSetOptimizationGoalValues::OFFSITE_CONVERSIONS,
  AdSetFields::DAILY_BUDGET => 15000,
  AdSetFields::CAMPAIGN_ID => <CAMPAIGN_ID>,
  AdSetFields::TARGETING => array(
    TargetingFields::GEO_LOCATIONS => array(
      'countries' => array('US'),
    ),
    TargetingFields::DYNAMIC_AUDIENCE_IDS => array(<DYNAMIC_AUDIENCE_ID>),
  ),
  AdSetFields::PROMOTED_OBJECT => array(
    'product_set_id' => <PRODUCT_SET_ID>,
  ),
));

$adset->create(array(
  AdSet::STATUS_PARAM_NAME => AdSet::STATUS_PAUSED,
));
from facebookads.adobjects.adaccount import AdAccount
from facebookads.adobjects.adset import AdSet
from facebookads.adobjects.targeting import Targeting

ad_account = AdAccount(fbid=ad_account_id)

params = {
    AdSet.Field.name: 'Product Catalog Sales Adset',
    AdSet.Field.bid_amount: 3000,
    AdSet.Field.billing_event: AdSet.BillingEvent.impressions,
    AdSet.Field.optimization_goal: AdSet.OptimizationGoal.offsite_conversions,
    AdSet.Field.daily_budget: 15000,
    AdSet.Field.campaign_id: campaign_id,
    AdSet.Field.targeting: {
        Targeting.Field.geo_locations: {
            Targeting.Field.countries: ['US'],
        },
        Targeting.Field.dynamic_audience_ids: [
            dynamic_audience_id,
        ],
    },
    AdSet.Field.promoted_object: {
        'product_set_id': product_set_id,
    },
}
adset = ad_account.create_ad_set(params=params)
AdSet adSet = new AdAccount(act_<AD_ACCOUNT_ID>, context).createAdSet()
  .setName("Product Catalog Sales Adset")
  .setBidAmount(3000L)
  .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS)
  .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_OFFSITE_CONVERSIONS)
  .setDailyBudget(15000L)
  .setCampaignId(<CAMPAIGN_ID>)
  .setTargeting(
    new Targeting()
      .setFieldDynamicAudienceIds(Arrays.asList(<DYNAMIC_AUDIENCE_ID>))
      .setFieldGeoLocations(
        new TargetingGeoLocation()
          .setFieldCountries(Arrays.asList("US"))
      )
  )
  .setPromotedObject("{\"product_set_id\":\"" + <PRODUCT_SET_ID> + "\"}")
  .setStatus(AdSet.EnumStatus.VALUE_PAUSED)
  .execute();
String ad_set_id = adSet.getId();
curl \
  -F 'name=Product Catalog Sales Adset' \
  -F 'bid_amount=3000' \
  -F 'billing_event=IMPRESSIONS' \
  -F 'optimization_goal=OFFSITE_CONVERSIONS' \
  -F 'daily_budget=15000' \
  -F 'campaign_id=<CAMPAIGN_ID>' \
  -F 'targeting={ 
    "geo_locations": {"countries":["US"]}, 
    "dynamic_audience_ids": ["<DYNAMIC_AUDIENCE_ID>"] 
  }' \
  -F 'promoted_object={"product_set_id":"<PRODUCT_SET_ID>"}' \
  -F 'status=PAUSED' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.10/act_<AD_ACCOUNT_ID>/adsets

Dynamic Ads for Travel does not support inline dynamic audience targeting specs in Dynamic Ad. You must separately create audiences, see DAT, Audiences.

Cross-sell and Upsell

To cross-sell or upsell between flights and hotels:

  • Create a travel event source group and provide the audience with event rules related to your first catalog, such as flights,
  • Show products from your second catalog, such as hotels, in the ad. Setting product_set_id to your second catalog at the ad creative level.

There are different strategies you can use. For example, increase hotels reservations in <PRODUCT_SET_ID> by targeting ads to existing users who have booked flights. You target with signals comming from your travel event source group with content_type=FLIGHT.

To do this, create a travel audience targeting people who initiated check out or purchased 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
from facebookads.adobjects.adaccount import AdAccount

ad_account = AdAccount(fbid='act_<AD_ACCOUNT_ID>')

params = {
    CustomAudience.Field.name: 'Travel Audience',
    CustomAudience.Field.subtype: CustomAudience.Subtype.claim,
    CustomAudience.Field.claim_objective: CustomAudience.ClaimObjective.travel,
    CustomAudience.Field.content_type: CustomAudience.ContentType.flight,
    CustomAudience.Field.event_source_group: <EVENT_SOURCE_GROUP_ID>,
    CustomAudience.Field.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 = ad_account.create_custom_audience(params=params)
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.10/act_<AD_ACCOUNT_ID>/customaudiences

Then, create an adset and set dynamic_audience_ids to this audience. Set the ad creative promoted_object to <PRODUCT_SET_ID>, as in Step 2: Create an Ad Set:

use FacebookAds\Object\AdCreative;
use FacebookAds\Object\Fields\AdCreativeFields;
use FacebookAds\Object\Fields\AdCreativeLinkDataFields;
use FacebookAds\Object\Fields\AdCreativeObjectStorySpecFields;
use FacebookAds\Object\Values\AdCreativeCallToActionTypeValues;
use FacebookAds\Object\AdCreativeObjectStorySpec;
use FacebookAds\Object\AdCreativeLinkData;

$object_story_spec = new AdCreativeObjectStorySpec();
$object_story_spec->setData(array(
  AdCreativeObjectStorySpecFields::PAGE_ID => <PAGE_ID>,
  AdCreativeObjectStorySpecFields::TEMPLATE_DATA =>
    (new AdCreativeLinkData())->setData(array(
      AdCreativeLinkDataFields::MESSAGE =>
        'Book your upcoming stay in {{hotel.city}}',
      AdCreativeLinkDataFields::NAME => '{{hotel.name | titleize}}',
      AdCreativeLinkDataFields::LINK => '<LINK>',
      AdCreativeLinkDataFields::DESCRIPTION =>
        '{{hotel.description}}',
      AdCreativeLinkDataFields::ADDITIONAL_IMAGE_INDEX => 0,
      AdCreativeLinkDataFields::CALL_TO_ACTION => array(
        'type' => AdCreativeCallToActionTypeValues::BOOK_TRAVEL,
      ),
    )),
));

$creative = new AdCreative(null, 'act_<AD_ACCOUNT_ID>');
$creative->setData(array(
  AdCreativeFields::NAME => 'Dynamic Ad Template Creative Sample',
  AdCreativeFields::OBJECT_STORY_SPEC => $object_story_spec,
  AdCreativeFields::TEMPLATE_URL_SPEC =>
    array(
      'config' => array(
        'app_id' => '123456789012345',
      ),
      'ios' => array(
        'url' => 'example://home/hotel'.
          '?id={{hotel.hotel_id | urlencode}}'.
          '&startDate={{trip.checkin_date date_format:Y-m-d | urlencode}}'.
          '&endDate={{trip.checkout_date date_format:Y-m-d | urlencode}}',
      ),
      'web' => array(
        'url' => 'http://www.example.com/hotel'.
          '?id={{hotel.hotel_id | urlencode}}'.
          '&startDate={{trip.checkin_date date_format:Y-m-d | urlencode}}'.
          '&endDate={{trip.checkout_date date_format:Y-m-d | urlencode}}',
      )
    ),
  AdCreativeFields::PRODUCT_SET_ID => <PRODUCT_SET_ID>,
));

$creative->create();
from facebookads.adobjects.adcreative import AdCreative
from facebookads.adobjects.adcreativeobjectstoryspec \
    import AdCreativeObjectStorySpec

story = AdCreativeObjectStorySpec()
story[story.Field.page_id] = <PAGE_ID>
story[story.Field.template_data] = {
    'message': 'Book your upcoming stay in {{hotel.city}}',
    'name': '{{hotel.name | titleize}}',
    'link': '<LINK>',
    'description': '{{hotel.description}}',
    'additional_image_index': 0,
    'call_to_action': {
        'type': 'BOOK_TRAVEL',
    },
}

creative = AdCreative(parent_id='act_<AD_ACCOUNT_ID>')
creative[AdCreative.Field.name] = 'Dynamic Ad Template Creative Sample'
creative[AdCreative.Field.object_story_spec] = story
template_url_spec = {
    'config': {
        'app_id': '123456789012345',
    },
    'ios': {
        'url': 'example://sub/?id={{hotel.hotel_id | urlencode}}' +
        '&startDate={{trip.checkin_date date_format:Y-m-d | urlencode}}' +
        '&endDate={{trip.checkout_date date_format:Y-m-d | urlencode}}',
    },
    'web': {
        'url': 'http://www.example.com/hotel.aspx?id={{hotel.hotel_id | urlencode}}' +
        '&startDate={{trip.checkin_date date_format:Y-m-d | urlencode}}' +
        '&endDate={{trip.checkout_date date_format:Y-m-d | urlencode}}',
    },
}
creative[AdCreative.Field.template_url_spec] = template_url_spec
creative[AdCreative.Field.product_set_id] = <PRODUCT_SET_ID>
creative.remote_create()
curl \
  -F 'name=Dynamic Ad Template Creative Sample' \
  -F 'object_story_spec={ 
    "page_id": "<PAGE_ID>", 
    "template_data": { 
      "additional_image_index": 0, 
      "call_to_action": {"type":"BOOK_TRAVEL"}, 
      "description": "{{hotel.description}}", 
      "link": "<LINK>", 
      "message": "Book your upcoming stay in {{hotel.city}}", 
      "name": "{{hotel.name | titleize}}" 
    } 
  }' \
  -F 'template_url_spec={ 
    "config": {"app_id":"123456789012345"}, 
    "ios": { 
      "url": "example:\/\/home\/hotel?id={{hotel.hotel_id | urlencode}}&startDate={{trip.checkin_date date_format:Y-m-d | urlencode}}&endDate={{trip.checkout_date date_format:Y-m-d | urlencode}}" 
    }, 
    "web": { 
      "url": "http:\/\/www.example.com\/hotel?id={{hotel.hotel_id | urlencode}}&startDate={{trip.checkin_date date_format:Y-m-d | urlencode}}&endDate={{trip.checkout_date date_format:Y-m-d | urlencode}}" 
    } 
  }' \
  -F 'product_set_id=<PRODUCT_SET_ID>' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.10/act_<AD_ACCOUNT_ID>/adcreatives

Step 3. Provide Ad Creative

Provide Dynamic Ad template creative, which is similar to ad creatives. The main difference is that you can add template parameters which Facebook uses at runtime based on data in your catalog and someone's travel intent.

As with Dynamic Ads, define template_data in object_story_spec in the ad creative. You can also use template_url_spec to define url and deeplinks in a more flexible way instead of using url from the feed. If template_url_spec cannot be constructed at ads rendering time (e.g. due to missing checkin/check out dates), we will fall back to the url from the catalog.

Below is an example to create a carousel creative for hotel. The same flow can be followed for destination by leveraing destination template tags.

use FacebookAds\Object\AdCreative;
use FacebookAds\Object\Fields\AdCreativeFields;
use FacebookAds\Object\Fields\AdCreativeLinkDataFields;
use FacebookAds\Object\Fields\AdCreativeObjectStorySpecFields;
use FacebookAds\Object\Values\AdCreativeCallToActionTypeValues;
use FacebookAds\Object\AdCreativeObjectStorySpec;
use FacebookAds\Object\AdCreativeLinkData;

$object_story_spec = new AdCreativeObjectStorySpec();
$object_story_spec->setData(array(
  AdCreativeObjectStorySpecFields::PAGE_ID => <PAGE_ID>,
  AdCreativeObjectStorySpecFields::TEMPLATE_DATA =>
    (new AdCreativeLinkData())->setData(array(
      AdCreativeLinkDataFields::MESSAGE =>
        'Book your upcoming stay in {{hotel.city}}',
      AdCreativeLinkDataFields::NAME => '{{hotel.name | titleize}}',
      AdCreativeLinkDataFields::LINK => '<LINK>',
      AdCreativeLinkDataFields::DESCRIPTION =>
        '{{hotel.description}}',
      AdCreativeLinkDataFields::ADDITIONAL_IMAGE_INDEX => 0,
      AdCreativeLinkDataFields::CALL_TO_ACTION => array(
        'type' => AdCreativeCallToActionTypeValues::BOOK_TRAVEL,
      ),
    )),
));

$creative = new AdCreative(null, 'act_<AD_ACCOUNT_ID>');
$creative->setData(array(
  AdCreativeFields::NAME => 'Dynamic Ad Template Creative Sample',
  AdCreativeFields::OBJECT_STORY_SPEC => $object_story_spec,
  AdCreativeFields::TEMPLATE_URL_SPEC =>
    array(
      'config' => array(
        'app_id' => '123456789012345',
      ),
      'ios' => array(
        'url' => 'example://home/hotel'.
          '?id={{hotel.hotel_id | urlencode}}'.
          '&startDate={{trip.checkin_date date_format:Y-m-d | urlencode}}'.
          '&endDate={{trip.checkout_date date_format:Y-m-d | urlencode}}',
      ),
      'web' => array(
        'url' => 'http://www.example.com/hotel'.
          '?id={{hotel.hotel_id | urlencode}}'.
          '&startDate={{trip.checkin_date date_format:Y-m-d | urlencode}}'.
          '&endDate={{trip.checkout_date date_format:Y-m-d | urlencode}}',
      )
    ),
  AdCreativeFields::PRODUCT_SET_ID => <PRODUCT_SET_ID>,
));

$creative->create();
from facebookads.adobjects.adcreative import AdCreative
from facebookads.adobjects.adcreativeobjectstoryspec \
    import AdCreativeObjectStorySpec

story = AdCreativeObjectStorySpec()
story[story.Field.page_id] = <PAGE_ID>
story[story.Field.template_data] = {
    'message': 'Book your upcoming stay in {{hotel.city}}',
    'name': '{{hotel.name | titleize}}',
    'link': '<LINK>',
    'description': '{{hotel.description}}',
    'additional_image_index': 0,
    'call_to_action': {
        'type': 'BOOK_TRAVEL',
    },
}

creative = AdCreative(parent_id='act_<AD_ACCOUNT_ID>')
creative[AdCreative.Field.name] = 'Dynamic Ad Template Creative Sample'
creative[AdCreative.Field.object_story_spec] = story
template_url_spec = {
    'config': {
        'app_id': '123456789012345',
    },
    'ios': {
        'url': 'example://sub/?id={{hotel.hotel_id | urlencode}}' +
        '&startDate={{trip.checkin_date date_format:Y-m-d | urlencode}}' +
        '&endDate={{trip.checkout_date date_format:Y-m-d | urlencode}}',
    },
    'web': {
        'url': 'http://www.example.com/hotel.aspx?id={{hotel.hotel_id | urlencode}}' +
        '&startDate={{trip.checkin_date date_format:Y-m-d | urlencode}}' +
        '&endDate={{trip.checkout_date date_format:Y-m-d | urlencode}}',
    },
}
creative[AdCreative.Field.template_url_spec] = template_url_spec
creative[AdCreative.Field.product_set_id] = <PRODUCT_SET_ID>
creative.remote_create()
curl \
  -F 'name=Dynamic Ad Template Creative Sample' \
  -F 'object_story_spec={ 
    "page_id": "<PAGE_ID>", 
    "template_data": { 
      "additional_image_index": 0, 
      "call_to_action": {"type":"BOOK_TRAVEL"}, 
      "description": "{{hotel.description}}", 
      "link": "<LINK>", 
      "message": "Book your upcoming stay in {{hotel.city}}", 
      "name": "{{hotel.name | titleize}}" 
    } 
  }' \
  -F 'template_url_spec={ 
    "config": {"app_id":"123456789012345"}, 
    "ios": { 
      "url": "example:\/\/home\/hotel?id={{hotel.hotel_id | urlencode}}&startDate={{trip.checkin_date date_format:Y-m-d | urlencode}}&endDate={{trip.checkout_date date_format:Y-m-d | urlencode}}" 
    }, 
    "web": { 
      "url": "http:\/\/www.example.com\/hotel?id={{hotel.hotel_id | urlencode}}&startDate={{trip.checkin_date date_format:Y-m-d | urlencode}}&endDate={{trip.checkout_date date_format:Y-m-d | urlencode}}" 
    } 
  }' \
  -F 'product_set_id=<PRODUCT_SET_ID>' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.10/act_<AD_ACCOUNT_ID>/adcreatives

If you're promoting a flight catalog, you have to use template_url_spec to construct your landing url since url field is not available in flight catalog.

Creative Format Options

Parameters are available to change the creative format. You can choose whether to show a single product or multiple products in a carousel. For single product ads, you can show multiple images in the carousel for that product. You can also display static cards in combination with dynamic cards. For more information about creative options, please see the general Dynamic Ads documentation about Building a Creative Template.

Showing multiple flights in a carousel is not recommended. However, you can leverage single product ads to show multiple images for the same flight.

Template Tags

When we delivery your ad, we substitute tags in {{...}} with the relevant value. We currently support these tags for creative template:

Hotel

Template tag Description

trip.checkin_date

The checkin date sourced from intent signals Facebook collects about the user, e.g. {{trip.checkin_date}} or {{trip.checkin_date date_format:Y-m-d}}. We support most of the date formats provided here

trip.checkout_date

The check out date sourced from intent signals Facebook collects about the user, e.g. {{trip.checkout_date}} or {{trip.checkout_date date_format:Y-m-d}}. We support most of the date formats provided here

trip.num_adults

Number of adult travelers, based on intent signals Facebook collects about the user. Currently defaults to 1, subject to change.

trip.num_children

Number of children travelers, based on intent signals Facebook collects about the user. Currently defaults to 0, subject to change.

trip.num_travelers

Sum of adult and children travelers, based on intent signals Facebook collects about the user. Currently defaults to 1, subject to change.

hotel.name

Hotel name provided in catalog

hotel.description

Hotel description provided in catalog

hotel.brand

Hotel brand provided in catalog

hotel.city

City provided in catalog

hotel.city_id

city id provided in catalog

hotel.country

Country provided in catalog

hotel.neighborhood

First neighborhood provided in catalog

hotel.url

Hotel url provided in catalog

hotel.hotel_id

ID of the hotel provided by advertiser in catalog

hotel.base_price

If dynamic pricing is provided, this will display the base price from room type. If advertiser has not provided dynamic pricing, this will display the base_price provided in static hotel feed

hotel.price

If dynamic pricing is provided, this will display the average dynamic price per night with tax and fees. If advertiser has not provided dynamic pricing, this will default to base price

hotel.sale_price

If dynamic pricing is provided, this will display the average dynamic sale price per night. If advertiser has not provided dynamic date-based sale price, this will default to sale price at the room level

hotel.total_price

If dynamic pricing is provided, this can be used to display the total price a user has to pay for the entire stay. This price includes tax and fees

Destination

Template tag Description

trip.travel_start

The trip start date sourced from intent signals Facebook collects about the user, e.g. {{trip.travel_start}} or {{trip.travel_start date_format:Y-m-d}}. We support most of the date formats provided here

trip.travel_end

The trip end date sourced from intent signals Facebook collects about the user, e.g. {{trip.travel_end}} or {{trip.travel_end date_format:Y-m-d}}. We support most of the date formats provided here

trip.num_adults

Number of adult travelers, based on intent signals Facebook collects about the user. Currently defaults to 1, subject to change.

trip.num_children

Number of children travelers, based on intent signals Facebook collects about the user. Currently defaults to 0, subject to change.

trip.num_travelers

Sum of adult and children travelers, based on intent signals Facebook collects about the user. Currently defaults to 1, subject to change.

destination.name

Destination name provided in catalog

destination.description

Destination description provided in catalog

destination.city

City provided in catalog

destination.country

Country provided in catalog

destination.url

Destination url provided in catalog

destination.destination_id

ID of the destination provided by advertiser in catalog

destination.price

Price of the destination provided in catalog

Flight

Template tag Description

trip.departing_departure_date

The departure date sourced from intent signals Facebook collects about the user, e.g. {{trip.departing_departure_date}} or {{trip.departing_departure_date date_format:Y-m-d}}. We support most of the date formats provided here

trip.returning_departure_date

The trip end date sourced from intent signals Facebook collects about the user, e.g. {{trip.returning_departure_date}} or {{trip.returning_departure_date date_format:Y-m-d}}. We support most of the date formats provided here

trip.num_adults

Number of adult travelers, based on intent signals Facebook collects about a user. Currently defaults to 1, subject to change.

trip.num_children

Number of children travelers, based on intent signals Facebook collects about the user. Currently defaults to 0, subject to change.

trip.num_infants

Number of infant travelers, based on intent signals Facebook collects about the user. Currently defaults to 0, subject to change.

trip.num_travelers

Sum of adult and children travelers, based on intent signals Facebook collects about the user. Currently defaults to 1, subject to change.

flight.destination_airport

The IATA code for the destination, such as SFO

flight.destination_city

Destination city name from flight feed, if provided. If not, city name associated with destination airport in English, such as San Francisco

flight.origin_airport

The IATA code for the destination, such as JFK

flight.origin_city

Origin city name from flight feed, if provided. If not, city name associated with destination airport in English, such as New York

flight.description

Flight description provided in catalog

flight.price

Price of the flight. For this option, you must provide a source of prices. To show a price from feed, use source:feed as the option: {{flight.price source:feed}}

flight.url

Flight URL provided in catalog

Template tags enable you to provide creative-specific capitalization and formatting without having to change your catalog.

With Dynamic Ads for Travel, you can also display static cards in combination with dynamic cards in the carousel ad unit. For more information about displaying static cards, please see Create Dynamic Ad Template Creatives.


Finally create your ad that delivers dynamic creative to the user based on your catalog:

use FacebookAds\Object\Ad;
use FacebookAds\Object\Fields\AdFields;

$data = array(
  AdFields::NAME => 'My Ad',
  AdFields::ADSET_ID => <AD_SET_ID>,
  AdFields::CREATIVE => array(
    'creative_id' => <CREATIVE_ID>,
  ),
);

$ad = new Ad(null, 'act_<AD_ACCOUNT_ID>');
$ad->setData($data);
$ad->create(array(
  Ad::STATUS_PARAM_NAME => Ad::STATUS_PAUSED,
));
from facebookads.adobjects.ad import Ad

ad = Ad(parent_id='act_<AD_ACCOUNT_ID>')
ad[Ad.Field.name] = 'My Ad'
ad[Ad.Field.adset_id] = <AD_SET_ID>
ad[Ad.Field.creative] = {
    'creative_id': <CREATIVE_ID>,
}
ad.remote_create(params={
    'status': Ad.Status.paused,
})
Ad ad = new AdAccount(act_<AD_ACCOUNT_ID>, context).createAd()
  .setName("My Ad")
  .setAdsetId(<AD_SET_ID>)
  .setCreative(
    new AdCreative()
      .setFieldId(<CREATIVE_ID>)
  )
  .setStatus(Ad.EnumStatus.VALUE_PAUSED)
  .execute();
curl \
  -F 'name=My Ad' \
  -F 'adset_id=<AD_SET_ID>' \
  -F 'creative={"creative_id":"<CREATIVE_ID>"}' \
  -F 'status=PAUSED' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.10/act_<AD_ACCOUNT_ID>/ads

If you want to deep-link an ad to a specific place in your mobile app, such as a hotel's profile or destination details, make sure you provide the correct deep-link fields in the catalog.

Congratulations! You have created your first Dynamic Travel Ad which should be visible in Ads Manager. Feel free to unpause it to start delivery.

What's Next

Preview Dynamic Ads for Travel

You can generate previews of your dynamic creative with Ad Previews API. Specifying the product_item_ids parameter or specify multiple items in product_item_ids to preview a Carousel Ad.

use FacebookAds\Object\AdCreative;
use FacebookAds\Object\Fields\AdPreviewFields;
use FacebookAds\Object\Values\AdPreviewAdFormatValues;

$creative = new AdCreative(<CREATIVE_ID>);
$preview = $creative->getPreviews(array(), array(
  AdPreviewFields::AD_FORMAT => AdPreviewAdFormatValues::DESKTOP_FEED_STANDARD,
  AdPreviewFields::PRODUCT_ITEM_IDS => array(
    '<HOTEL_FBID>',
  ),
));
from facebookads.adobjects.adcreative import AdCreative
from facebookads.adobjects.adpreview import AdPreview

creative = AdCreative(<CREATIVE_ID>)
params = {
    'ad_format':
        AdPreview.AdFormat.desktop_feed_standard,
    'product_item_ids': [
        '<HOTEL_FBID>',
    ],
}
preview = creative.get_previews(params=params)
curl -G \
  -d 'ad_format=DESKTOP_FEED_STANDARD' \
  -d 'product_item_ids=["<HOTEL_FBID>"]' \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.10/<CREATIVE_ID>/previews

Parameters:

Field Name Description Type

product_item_ids

  • Hotel: List of hotel FBID or Base64url-encoded hotel ID tokens. Each token is of the form hotel_catalog:{catalog_id}:{base64urlencode(hotel_id)}

  • Destination: List of destination FBID or Base64url-encoded destination ID tokens. Each token is of the form destination_catalog:{catalog_id}:{base64urlencode(destination_id)}

array[string]

start_date

Render the preview with user's intent signal, e.g. 2016-12-24.

  • For hotel, this would be the value of trip.checkin_date
  • For destination, this would be the value of trip.travel_start

string

end_date

Render the preview with user's intent signal, e.g. 2017-01-01.

  • For hotel, this would be the value of trip.checkout_date
  • For destination, this would be the value of trip.travel_end

string


Fetch Travel Ad Insights & Statistics

To fetch ad Insights for a travel object, such as hotel, make a GET call to /insights. Remember to add product_id to the breakdown parameter. For hotel and destination, product id breakdown will be shown for each hotel_id or destination_id. For flight, product id breakdown will show origin_airport:destination_airport.


Fetch Comments and Likes

To retrieve comments, likes of dynamic ads, use the Dynamic Post API.