Los anuncios de hoteles usan cuatro eventos. Cada evento tiene un conjunto de parámetros (consulta la lista completa en los detalles de los parámetros de eventos). Usa el píxel de Facebook en tu sitio web y los eventos de la app para celulares en tu app para Android o iOS.
Evento | Cuándo se debe activar | Código de ejemplo |
---|---|---|
Search | En la página de resultados de búsqueda del hotel | |
ViewContent | En la página de detalles del hotel | |
InitiateCheckout | Cuando el usuario ingresa en la pantalla de pago | |
Purchase | En la página de confirmación de la reserva |
En esta guía, se asume que ya tienes instalado el píxel de Facebook. Si no es así, consulta Usar la API de marketing con el píxel.
Asegúrate de que el código base del píxel ya esté cargado cuando actives un evento. Si usas un administrador de etiquetas, asegúrate de incluir la etiqueta que contiene el código del píxel en cada página. Esta etiqueta debe aparecer antes de la que contiene el código de evento del píxel. Usa el asistente para píxeles de Facebook a fin de validar la implementación del píxel.
// This sample assumes the FB 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 // RECOMMENDED: set to 'hotel' content_type: 'hotel', // HIGHLY RECOMMENDED: checkin 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 checkin_date: '2018-04-01', // HIGHLY RECOMMENDED: checkout date // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD checkout_date: '2018-04-05', // RECOMMENDED: content ids - include eg top 5 search results content_ids: '["123", "234", "345", "456", "567"]', // 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: number of adults num_adults: 1, // RECOMMENDED: number of children num_children: 0 });
// This sample assumes the FB Pixel base code is already loaded fbq('track', 'ViewContent', { // Fire the 'ViewContent' event on the hotel details page // IF YOU CHOOSE NOT TO USE A RECOMMENDED PARAM, THEN REMOVE IT, DON'T LEAVE IT EMPTY // RECOMMENDED: set to 'hotel' content_type: 'hotel', // HIGHLY RECOMMENDED: checkin 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 checkin_date: '2018-04-01', // HIGHLY RECOMMENDED: checkout date // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD checkout_date: '2018-04-05', // REQUIRED: content id of hotel that is shown content_ids: '123', // 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 });
// This sample assumes the FB 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 // RECOMMENDED: set to 'hotel' content_type: 'hotel', // HIGHLY RECOMMENDED: checkin 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 checkin_date: '2018-04-01', // HIGHLY RECOMMENDED: checkout date // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD checkout_date: '2018-04-05', // REQUIRED: content id of hotel that being booked content_ids: '123', // 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 });
// This sample assumes the FB Pixel base code is already loaded fbq('track', 'Purchase', { // Fire the 'Purchase' event on the booking confirmed page // IF YOU CHOOSE NOT TO USE A RECOMMENDED PARAM, THEN REMOVE IT, DON'T LEAVE IT EMPTY // RECOMMENDED: set to set to 'hotel' content_type: 'hotel', // HIGHLY RECOMMENDED: checkin 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 checkin_date: '2018-04-01', // HIGHLY RECOMMENDED: checkout date // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD checkout_date: '2018-04-05', // REQUIRED: content id of hotel that was booked content_ids: '123', // RECOMMENDED: city, don't use abbreviations city: 'New York', // RECOMMENDED: region, don't use abbreviations region: 'New York', // RECOMMENDED: country country: 'United States', // RECOMMENDED: number of adults num_adults: 1, // RECOMMENDED: number of children num_children: 0, // REQUIRED: total value of booking value: 1200, // REQUIRED: currency of booking currency: 'USD' });
En esta guía, se asume que tienes el SDK de Facebook implementado en tu aplicación para celulares para Android. De lo contrario, consulta SDK para Android. Si usas un socio de medición, asegúrate de que este pase los eventos necesarios a Facebook.
Bundle parameters = new Bundle(); // IF YOU CHOOSE NOT TO USE A RECOMMENDED PARAM, THEN REMOVE IT, DON'T LEAVE IT EMPTY // RECOMMENDED: set to 'hotel' parameters.putString(AppEventsConstants.EVENT_PARAM_CONTENT_TYPE, "hotel"); // RECOMMENDED: content ids - include eg top 5 search results parameters.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID, "[\"123\", \"234\", \"345\", \"456\", \"567\"]"); // top search results // HIGHLY RECOMMENDED: checkin 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_checkin_date", "2018-04-01"); // HIGHLY RECOMMENDED: checkout date // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD parameters.putString("fb_checkout_date", "2018-04-05"); // 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: 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 );
Bundle parameters = new Bundle(); // IF YOU CHOOSE NOT TO USE A RECOMMENDED PARAM, THEN REMOVE IT, DON'T LEAVE IT EMPTY // RECOMMENDED: set to 'hotel' parameters.putString(AppEventsConstants.EVENT_PARAM_CONTENT_TYPE, "hotel"); // REQUIRED: content id of hotel that is shown parameters.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID, "123"); // HIGHLY RECOMMENDED: checkin 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_checkin_date", "2018-04-01"); // HIGHLY RECOMMENDED: checkout date // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD parameters.putString("fb_checkout_date", "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 hotel details page logger.logEvent( AppEventsConstants.EVENT_NAME_VIEWED_CONTENT, parameters );
Bundle parameters = new Bundle(); // IF YOU CHOOSE NOT TO USE A RECOMMENDED PARAM, THEN REMOVE IT, DON'T LEAVE IT EMPTY // RECOMMENDED: set to 'hotel' parameters.putString(AppEventsConstants.EVENT_PARAM_CONTENT_TYPE, "hotel"); // REQUIRED: content id of hotel that is being booked parameters.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID, "123"); // HIGHLY RECOMMENDED: checkin 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_checkin_date", "2018-04-01"); // HIGHLY RECOMMENDED: checkout date // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD parameters.putString("fb_checkout_date", "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 'InitiateCheckout' event when the user enters the payment screen logger.logEvent( AppEventsConstants.EVENT_NAME_INITIATED_CHECKOUT, parameters );
// 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 // RECOMMENDED: set to 'hotel' parameters.putString(AppEventsConstants.EVENT_PARAM_CONTENT_TYPE, "hotel"); // REQUIRED: content id of hotel that was booked parameters.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID, "123"); // HIGHLY RECOMMENDED: checkin 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_checkin_date", "2018-04-01"); // HIGHLY RECOMMENDED: checkout date // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD parameters.putString("fb_checkout_date", "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); // Use the built-in SDK method when the booking is confirmed logger.logPurchase( purchaseAmount, currency, parameters );
En esta guía, se asume que ya tienes el SDK de Facebook implementado en tu aplicación para celulares para iOS. De lo contrario, consulta SDK para iOS. Si usas un socio de medición, asegúrate de que este pase los eventos necesarios a Facebook.
// 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: DO NOT change this, must be set to 'hotel' FBSDKAppEventParameterNameContentType : @"hotel", // RECOMMENDED: content ids - include eg top 5 search results FBSDKAppEventParameterNameContentID : @"[\"123\", \"234\", \"345\", \"456\", \"567\"]", // HIGHLY RECOMMENDED: checkin 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_checkin_date" : @"2018-04-01", // HIGHLY RECOMMENDED: checkout date // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD @"fb_checkout_date" : @"2018-04-15", // 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: number of adults @"fb_num_adults" : @1, // RECOMMENDED: number of children @"fb_num_children" : @0 } ];
// Fire the 'ViewContent' event on the hotel 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: DO NOT change this, must be set to 'hotel' FBSDKAppEventParameterNameContentType : @"hotel", // REQUIRED: content id of hotel that is shown FBSDKAppEventParameterNameContentID : @"123", // HIGHLY RECOMMENDED: checkin 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_checkin_date" : @"2018-04-01", // HIGHLY RECOMMENDED: checkout date // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD @"fb_checkout_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 } ];
// 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: DO NOT change this, must be set to 'hotel' FBSDKAppEventParameterNameContentType : @"hotel", // REQUIRED: content id of hotel that is shown FBSDKAppEventParameterNameContentID : @"123", // HIGHLY RECOMMENDED: checkin 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_checkin_date" : @"2018-04-01", // HIGHLY RECOMMENDED: checkout date // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD @"fb_checkout_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 } ];
// Fire the 'Purchase' event when the booking is confirmed // total value of booking [[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: DO NOT change this, must be set to 'hotel' FBSDKAppEventParameterNameContentType : @"hotel", // REQUIRED: content id of hotel that is shown FBSDKAppEventParameterNameContentID : @"123", // HIGHLY RECOMMENDED: checkin 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_checkin_date" : @"2018-04-01", // HIGHLY RECOMMENDED: checkout date // use YYYYMMDD, YYYY-MM-DD, YYYY-MM-DDThh:mmTZD or YYYY-MM-DDThh:mm:ssTZD @"fb_checkout_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 } ];
En el celular, los nombres de los parámetros son diferentes con respecto al píxel de Facebook. A menudo, tienen fb_
antepuesto, pero hay algunas excepciones, como content_ids
, que varía a fb_content_id
, y value
, que es _valueToSum
.
Cuando envíes varios valores, por ejemplo, con content_ids
o content_type
, proporciona una matriz de valores cifrada mediante JSON: '["value1", "value2"]'
. No concatenes los valores con una coma.
Nombre y tipo de parámetro | Descripción |
---|---|
Tipo: cadena | Muy recomendado. Fecha en que el usuario desea registrar su llegada al hotel, en la zona horaria del hotel. Aceptamos fechas en Ejemplos:
|
Tipo: cadena | Muy recomendado. Fecha en que el usuario desea registrar su salida del hotel, en la zona horaria del hotel. Se aceptan los mismos formatos de fecha que en |
Tipo: cadena o cadena[] | Recomendado para Los identificadores correspondientes tal como figuran en el catálogo de viajes. P. ej., para el evento Ejemplos:
|
Tipo: cadena o cadena[] | Recomendado. Debe ser |
Tipo: cadena | Obligatorio en el caso de Proporciona la ciudad de la ubicación a partir de la intención del usuario. Ejemplo: |
Tipo: cadena | Obligatorio para Proporciona el estado, el distrito o la región de la ubicación a partir de la intención del usuario. Por ejemplo: |
Tipo: cadena | Obligatorio en el caso de Proporciona el país de la ubicación a partir de la intención del usuario. Ejemplo: |
Tipo: flotante | Obligatorio para Precio total de la reserva (número que cuantifica el valor del evento para el anunciante). Ejemplo: |
Tipo: cadena | Obligatorio para Divisa para Ejemplo: |
Tipo: cadena o cadena[] | Si tienes un catálogo de destinos, puedes asociar uno o más destinos en el catálogo con un evento de hotel en particular. Por ejemplo, puedes vincular un hotel específico a un museo y una playa cercanos y que ambos estén incluidos en el catálogo de destinos. Ejemplo: |
Tipo: flotante | Indicador que representa el valor relativo de este hotel para el anunciante, en comparación con sus otros hoteles. Ejemplo: |
Tipo: cadena | Número de adultos que se hospedarán. Cuando se proporciona, puedes usarlo en el anuncio mediante etiquetas de plantillas. Ejemplo: |
Tipo: entero | Número de niños que se hospedarán. Cuando se proporciona, puedes usarlo en el anuncio mediante etiquetas de plantillas. Ejemplo: |
type: cadena[] | Lista de los barrios preferidos que el usuario filtra. Ejemplo: |
Tipo: [int (mín.), int (máx.)] | Tupla de tarifas de habitación mínimas y máximas que el usuario filtra. Ejemplo: |
Tipo: [int (mín.), int (máx.)] | Tupla de calificaciones con estrellas de hoteles mínimas y máximas que el usuario filtra. Ejemplo: |
Tipo: flotante | Indicador que representa el valor relativo del usuario para el anunciante. Ejemplo: |