目的地廣告 - 事件

目的地廣告使用四種事件。每項事件都有一組參數(完整清單請見事件參數詳情)。在網站上使用 Meta 像素;在 Android 應用程式iOS 應用程式中使用流動應用程式事件。進一步了解標準與自訂事件

事件觸發時機程式碼範例

Search

在目的地搜尋結果頁面

PixelAndroidiOS

ViewContent

在目的地詳情頁面

PixelAndroidiOS

InitiateCheckout

當用戶進入付款畫面時

PixelAndroidiOS

Purchase

在購買確認頁面

PixelAndroidiOS

Facebook Pixel (for Websites)

This guide assumes you already have a Facebook Pixel installed. If not, see Using Marketing API with the Pixel.

Make sure the pixel base code is already loaded when you fire an event. If you use a tag manager, make sure you include the tag that contains the pixel code on every page. The tag should appear before the tag that contains the pixel event code. Use the Facebook Pixel Helper to validate your pixel implementation.

Search 像素事件

// This sample assumes the Meta Pixel base code is already loaded

fbq('track', 'Search', {
  // Fire the 'Search' event on the search results page

  // IF YOU CHOOSE NOT TO USE A RECOMMENDED PARAM, THEN REMOVE IT, DON'T LEAVE IT EMPTY

  // REQUIRED: city, don't use abbreviations
  city: 'New York',

  // REQUIRED: region, don't use abbreviations
  region: 'New York',

  // REQUIRED: country, don't use abbreviations
  country: 'United States',    

  // RECOMMENDED: set to 'destination'
  content_type: 'destination',

  // RECOMMENDED: travel start date
  // Allows you to target people based on their travel dates (using a booking window)
  // Improves the landing experience with travel dates filled in (using template tags)
  // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD
  travel_start: '2018-04-01',

  // RECOMMENDED: travel end date
  // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD
  travel_end: '2018-04-05',

  // RECOMMENDED: content ids - include eg top 5 search results
  content_ids: '["123", "234", "345", "456", "567"]',    

  // RECOMMENDED: number of adults
  num_adults: 1,

  // RECOMMENDED: number of children
  num_children: 0
});

ViewContent 像素事件

// This sample assumes the Meta Pixel base code is already loaded

fbq('track', 'ViewContent', {
  // Fire the 'ViewContent' event on the destination details page

  // IF YOU CHOOSE NOT TO USE A RECOMMENDED PARAM, THEN REMOVE IT, DON'T LEAVE IT EMPTY

  // REQUIRED: content id of destination that is shown
  content_ids: '123',      

  // RECOMMENDED: set to : 'destination',

  // RECOMMENDED: travel start date
  // Allows you to target people based on their travel dates (using a booking window)
  // Improves the landing experience with travel dates filled in (using template tags)
  // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD
  travel_start: '2018-04-01',

  // RECOMMENDED: travel end date
  // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD
  travel_end: '2018-04-05',

  // RECOMMENDED: city, don't use abbreviations
  city: 'New York',

  // RECOMMENDED: region, don't use abbreviations
  region: 'New York',

  // RECOMMENDED: country, don't use abbreviations
  country: 'United States',

  // RECOMMENDED: number of adults
  num_adults: 1,

  // RECOMMENDED: number of children
  num_children: 0
});

InitiateCheckout 像素事件

// This sample assumes the Meta Pixel base code is already loaded

fbq('track', 'InitiateCheckout', {
   // Fire the 'InitiateCheckout' event when the user enters the payment screen

  // IF YOU CHOOSE NOT TO USE A RECOMMENDED PARAM, THEN REMOVE IT, DON'T LEAVE IT EMPTY

  // REQUIRED: content id of destination that is being booked
  content_ids: '123',

  // REQUIRED: city, don't use abbreviations
  city: 'New York',

  // REQUIRED: region, don't use abbreviations
  region: 'New York',  

  // REQUIRED: country, don't use abbreviations
  country: 'United States',

  // RECOMMENDED: set to 'destination'
  content_type: 'destination',

  // RECOMMENDED: travel start date
  // Allows you to target people based on their travel dates (using a booking window)
  // Improves the landing experience with travel dates filled in (using template tags)
  // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD
  travel_start: '2018-04-01',

  // RECOMMENDED: travel end date
  // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD
  travel_end: '2018-04-05',
 
  // RECOMMENDED: number of adults
  num_adults: 1,

  // RECOMMENDED: number of children
  num_children: 0
});

Purchase 像素事件

// This sample assumes the Meta Pixel base code is already loaded

fbq('track', 'Purchase', {
   // Fire the 'Purchase' event on the booking or purchase confirmation page

  // IF YOU CHOOSE NOT TO USE A RECOMMENDED PARAM, THEN REMOVE IT, DON'T LEAVE IT EMPTY
  
  // REQUIRED: content id of destination that is being booked
  content_ids: '123',

  // REQUIRED: city, don't use abbreviations
  city: 'New York',

  // REQUIRED: region, don't use abbreviations
  region: 'New York',

  // REQUIRED: country, don't use abbreviations
  country: 'United States',

// REQUIRED: total value of booking
  value: 1200,

  // REQUIRED: currency of booking
  currency: 'USD',

  // RECOMMENDED: set to 'destination'
  content_type: 'destination',

  // RECOMMENDED: travel start date
  // Allows you to target people based on their travel dates (using a booking window)
  // Improves the landing experience with travel dates filled in (using template tags)
  // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD
  travel_start: '2018-04-01',

  // RECOMMENDED: travel end date
  // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD
  travel_end: '2018-04-05',  

  // RECOMMENDED: number of adults
  num_adults: 1,

  // RECOMMENDED: number of children
  num_children: 0  
});

Mobile App Events for Android

This guide assumes you have the Facebook SDK implemented in your Android mobile app. If not, see the Android SDK. If you use a measurement partner, make sure they pass required events to Facebook.

Search Android 事件

Bundle parameters = new Bundle();
// IF YOU CHOOSE NOT TO USE A RECOMMENDED PARAM, THEN REMOVE IT, DON'T LEAVE IT EMPTY

// REQUIRED: city, don't use abbreviations
parameters.putString("fb_city", "New York");

// REQUIRED: region, don't use abbreviations
parameters.putString("fb_region", "New York");

// REQUIRED: country
parameters.putString("fb_country", "United States");    

// RECOMMENDED: set to 'destination'
parameters.putString(AppEventsConstants.EVENT_PARAM_CONTENT_TYPE, "destination");

// RECOMMENDED: content ids - include eg top 5 search results
parameters.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID, "[\"123\", \"234\", \"345\", \"456\", \"567\"]"); // top search results

// RECOMMENDED: travel start date
// Allows you to target people based on their travel dates (using a booking window)
// Improves the landing experience with travel dates filled in (using template tags)
// use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD
parameters.putString("fb_travel_start", "2018-04-01");

// RECOMMENDED: travel end date
// use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD
parameters.putString("fb_travel_end", "2018-04-05");

// RECOMMENDED: number of adults
parameters.putInt("fb_num_adults", 1);

// RECOMMENDED: number of children
parameters.putInt("fb_num_children", 0);

// Fire the 'Search' event on the search results page
logger.logEvent(
  AppEventsConstants.EVENT_NAME_SEARCHED,
  parameters
);

ViewContent Android 事件

Bundle parameters = new Bundle();
// IF YOU CHOOSE NOT TO USE A RECOMMENDED PARAM, THEN REMOVE IT, DON'T LEAVE IT EMPTY

// REQUIRED: content id of destination that is shown
parameters.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID, "123");    

// RECOMMENDED: set to 'destination'
parameters.putString(AppEventsConstants.EVENT_PARAM_CONTENT_TYPE, "destination");

// RECOMMENDED: travel start date
// Allows you to target people based on their travel dates (using a booking window)
// Improves the landing experience with travel dates filled in (using template tags)
// use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD
parameters.putString("fb_travel_start", "2018-04-01");

// RECOMMENDED: travel end date
// use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD
parameters.putString("fb_travel_end", "2018-04-05");

// RECOMMENDED: city, don't use abbreviations
parameters.putString("fb_city", "New York");

// RECOMMENDED: region, don't use abbreviations
parameters.putString("fb_region", "New York");

// RECOMMENDED: country
parameters.putString("fb_country", "United States");

// RECOMMENDED: number of adults
parameters.putInt("fb_num_adults", 1);

// RECOMMENDED: number of children
parameters.putInt("fb_num_children", 0);

// Fire the 'ViewContent' event on the destination details page
logger.logEvent(
  AppEventsConstants.EVENT_NAME_VIEWED_CONTENT,
  parameters
);

InitiateCheckout Android 事件

Bundle parameters = new Bundle();
// IF YOU CHOOSE NOT TO USE A RECOMMENDED PARAM, THEN REMOVE IT, DON'T LEAVE IT EMPTY

// REQUIRED: content id of destination that is being booked
parameters.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID, "123");

// RECOMMENDED: set to 'destination'
parameters.putString(AppEventsConstants.EVENT_PARAM_CONTENT_TYPE, "destination");

// REQUIRED: city, don't use abbreviations
parameters.putString("fb_city", "New York");

// REQUIRED: region, don't use abbreviations
parameters.putString("fb_region", "New York");

// REQUIRED: country
parameters.putString("fb_country", "United States");

// RECOMMENDED: travel start date
// Allows you to target people based on their travel dates (using a booking window)
// Improves the landing experience with travel dates filled in (using template tags)
// use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD
parameters.putString("fb_travel_start", "2018-04-01");

// RECOMMENDED: travel end date
// use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD
parameters.putString("fb_travel_end", "2018-04-05");

// RECOMMENDED: number of adults
parameters.putInt("fb_num_adults", 1);

// RECOMMENDED: number of children
parameters.putInt("fb_num_children", 0);

// Fire the 'InitiateCheckout' event when the user enters the payment screen
logger.logEvent(
  AppEventsConstants.EVENT_NAME_INITIATED_CHECKOUT,
  parameters
);

Purchase Android 事件

// total value of booking
BigDecimal purchaseAmount = BigDecimal.valueOf(1200);

// REQUIRED: currency of booking
Currency currency = Currency.getInstance("USD");

Bundle parameters = new Bundle();
// IF YOU CHOOSE NOT TO USE A RECOMMENDED PARAM, THEN REMOVE IT, DON'T LEAVE IT EMPTY

// REQUIRED: content id of destination that is being booked
parameters.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID, "123");

// REQUIRED: city, don't use abbreviations
parameters.putString("fb_city", "New York");

// REQUIRED: region, don't use abbreviations
parameters.putString("fb_region", "New York");

// REQUIRED: country
parameters.putString("fb_country", "United States");

// RECOMMENDED: set to 'destination'
parameters.putString(AppEventsConstants.EVENT_PARAM_CONTENT_TYPE, "destination");

// RECOMMENDED: travel start date
// Allows you to target people based on their travel dates (using a booking window)
// Improves the landing experience with travel dates filled in (using template tags)
// use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD
parameters.putString("fb_travel_start", "2018-04-01");

// RECOMMENDED: travel end date
// use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD
parameters.putString("fb_travel_end", "2018-04-05");

// RECOMMENDED: number of adults
parameters.putInt("fb_num_adults", 1);

// RECOMMENDED: number of children
parameters.putInt("fb_num_children", 0);

// Use the built-in SDK method when the booking is confirmed
logger.logPurchase(
  purchaseAmount,
  currency,
  parameters
);

iOS 版流動應用程式事件

本指南假設您已在 iOS 流動應用程式內安裝 Facebook SDK。若您尚未安裝,請參考 iOS SDK。如果您有成效衡量合作夥伴,請務必要求他們傳送必要事件至 Facebook。

Search iOS 事件

// Fire the 'Search' event on the search results page  
[[FBSDKAppEvents shared] logEvent:FBSDKAppEventNameSearched

  // IF YOU CHOOSE NOT TO USE A RECOMMENDED PARAM, THEN REMOVE IT, DON'T LEAVE IT EMPTY
  parameters:@{

    // REQUIRED: city, don't use abbreviations
    @"fb_city" : @"New York",

    // REQUIRED: region, don't use abbreviations
    @"fb_region" : @"New York",

    // REQUIRED: country, don't use abbreviations
    @"fb_country" : @"United States",

    // RECOMMENDED: If sent, it must be set to 'destination'
    FBSDKAppEventParameterNameContentType : @"destination",

    // RECOMMENDED: content ids - include eg top 5 search results
    FBSDKAppEventParameterNameContentID : @"[\"123\", \"234\", \"345\", \"456\", \"567\"]",

    // RECOMMENDED: travel start date
    // Allows you to target people based on their travel dates (using a booking window)
    // Improves the landing experience with travel dates filled in (using template tags)
    // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD
    @"fb_travel_start" : @"2018-04-01",

    // RECOMMENDED: travel end date
    // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD
    @"fb_travel_end" : @"2018-04-15",

    // RECOMMENDED: number of adults
    @"fb_num_adults" : @1,

    // RECOMMENDED: number of children
    @"fb_num_children" : @0
  }
];

ViewContent iOS 事件

// Fire the 'ViewContent' event on the destination details page
[[FBSDKAppEvents shared] logEvent:FBSDKAppEventNameViewedContent

  // IF YOU CHOOSE NOT TO USE A RECOMMENDED PARAM, THEN REMOVE IT, DON'T LEAVE IT EMPTY
  parameters:@{

    // REQUIRED: content id of destination that is shown
    FBSDKAppEventParameterNameContentID : @"123",

    // RECOMMENDED: If sent, it must be set to 'destination'
    FBSDKAppEventParameterNameContentType : @"destination",

    // RECOMMENDED: travel start date
     // Allows you to target people based on their travel dates (using a booking window)
     // Improves the landing experience with travel dates filled in (using template tags)
    // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD
    @"fb_travel_start_date" : @"2018-04-01",

    // RECOMMENDED: travel end date
    // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD
    @"fb_travel_end_date" : @"2018-04-15",

    // RECOMMENDED: city, don't use abbreviations
    @"fb_city" : @"New York",

    // RECOMMENDED: region, don't use abbreviations
    @"fb_region" : @"New York",

    // RECOMMENDED: country, don't use abbreviations
    @"fb_country" : @"United States",

    // RECOMMENDED: number of adults
    @"fb_num_adults" : @1,

    // RECOMMENDED: number of children
    @"fb_num_children" : @0
  }
];

InitiateCheckout iOS 事件

// Fire the 'InitiateCheckout' event when the user enters the payment screen
[[FBSDKAppEvents shared] logEvent:FBSDKAppEventNameInitiatedCheckout

  // IF YOU CHOOSE NOT TO USE A RECOMMENDED PARAM, THEN REMOVE IT, DON'T LEAVE IT EMPTY
  parameters:@{

    // REQUIRED: content id of destination that is being booked
    FBSDKAppEventParameterNameContentID : @"123",

    // RECOMMENDED: If sent, it must be set to 'destination'
    FBSDKAppEventParameterNameContentType : @"destination",

    // REQUIRED: city, don't use abbreviations
    @"fb_city" : @"New York",

    // REQUIRED: region, don't use abbreviations
    @"fb_region" : @"New York",

    // REQUIRED: country, don't use abbreviations
    @"fb_country" : @"United States",

    // RECOMMENDED: travel start date
    // Allows you to target people based on their travel dates (using a booking window)
    // Improves the landing experience with travel dates filled in (using template tags)
    // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD
    @"fb_travel_start" : @"2018-04-01",

    // RECOMMENDED: travel end date
    // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD
    @"fb_travel_end" : @"2018-04-15",

    // RECOMMENDED: number of adults
    @"fb_num_adults" : @1,

    // RECOMMENDED: number of children
    @"fb_num_children" : @0
  }
];

Purchase iOS 事件

// Fire the 'Purchase' event when the booking is confirmed
[[FBSDKAppEvents shared] logPurchase:1200

  // currency of booking
  currency:@"USD"

  // IF YOU CHOOSE NOT TO USE A RECOMMENDED PARAM, THEN REMOVE IT, DON'T LEAVE IT EMPTY
  parameters:@{

    // REQUIRED: content id of destination that is being booked
    FBSDKAppEventParameterNameContentID : @"123",

    // RECOMMENDED: If sent, it must be set to 'destination'
    FBSDKAppEventParameterNameContentType : @"destination",

    // REQUIRED: city, don't use abbreviations
    @"fb_city" : @"New York",

    // REQUIRED: region, don't use abbreviations
    @"fb_region" : @"New York",

    // REQUIRED: country, don't use abbreviations
    @"fb_country" : @"United States",

    // RECOMMENDED: travel start date
     // Allows you to target people based on their travel dates (using a booking window)
     // Improves the landing experience with travel dates filled in (using template tags)
    // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD
    @"fb_travel_start" : @"2018-04-01",

    // RECOMMENDED: travel end date
    // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD
    @"fb_travel_end" : @"2018-04-15",

    // RECOMMENDED: number of adults
    @"fb_num_adults" : @1,

    // RECOMMENDED: number of children
    @"fb_num_children" : @0
  }
];

事件參數詳情

流動裝置上的參數名稱與 Meta 像素的版本不同。它們的前綴一般為 fb_,但也有些例外項目,例如 content_idsfb_content_idvalue_valueToSum

當您傳送多個值,例如 content_idscontent_type,請提供值的 JSON 編碼陣列:'["value1", "value2"]'切勿使用逗號串連不同的值。

參數名稱與類型說明

travel_start(像素)

fb_travel_start(應用程式)

類型:字串

此為建議項目

用戶旅程的開始日期。我們接受採用 YYYYMMDDYYYY-MM-DDYYYY-MM-DDThh:mmTZDYYYY-MM-DDThh:mm:ssTZD 格式的日期。提供後,您就可以透過範本標籤將此用於廣告中,並運用受眾的預訂時段,根據他們的旅遊日期來鎖定目標廣告受眾。

範例:

  • 20180623
  • 2018-06-23
  • 2017-06-23T15:30GMT
  • 2017-06-23T15:30:00GMT

travel_end(像素)

fb_travel_end(應用程式)

類型:字串

此為建議項目

用戶旅程的結束日期。我們接受和 travel_start 一樣的日期格式。提供後,您就可以透過範本標籤將此用於廣告中,並運用受眾的預訂時段,根據他們的旅遊日期來鎖定目標廣告受眾。

content_ids(像素)

fb_content_id(應用程式)

類型:字串或字串[]

建議為 search 事件採用,若是所有其他事件則為必要項目

您的旅遊目錄中列出的任何相關編號。例如,若是 ViewContent 事件,您或會傳送展示項目的編號;若是 Search 事件,您則可能會傳送最熱門搜尋結果的編號陣列。

範例:

  • "1234"
  • '["1234", "2345", "3456"]'

content_type(像素)

fb_content_type(應用程式)

類型:字串或字串[]

此為建議項目

如要傳送,則必須為 destination。如果結合其他 DAT 產品(例如酒店),請改用 '["destination", "hotel"]'

city(像素)

fb_city(應用程式)

類型:字串

search必要項目

根據用戶意向提供地點所在的城市。

範例:Auckland

region(像素)

fb_region(應用程式)

類型:字串

search必要項目

根據用戶意向提供目的地所在的地區。

範例:Manhattan

country(像素)

fb_country(應用程式)

類型:字串

search必要項目

根據用戶意向提供地點所在的國家/地區。

範例:New Zealand

num_adults(像素)

fb_num_adults(應用程式)

類型:字串

旅遊的成人人數。提供後,您就可以透過範本標籤將此用於廣告中。

範例:2

num_children(像素)

fb_num_children(應用程式)

類型:整數

旅遊的兒童人數。提供後,您就可以透過範本標籤將此用於廣告中。

範例:2

suggested_destinations(像素)

fb_suggested_destinations(應用程式)

類型:string 或 string[]

此為編號清單,而這些編號則表示此用戶的建議目的地。此參數並不適用於 Search 事件。

範例:'["1234", "2345", "3456"]'

value(像素)

_valueToSum(應用程式)

類型:浮點

購買事件所需的欄位。預訂的總金額(此數字為此事件對於廣告顧客的量化值)。

範例:155

currency(像素)

fb_currency(應用程式)

類型:字串

購買事件所需的欄位。值為貨幣。使用 ISO 4217 貨幣格式來指定。

範例:USD