Los anuncios de destino usan cuatro eventos. Cada evento tiene un conjunto de parámetros (puedes ver la lista completa en los detalles de parámetros de eventos). Usa el píxel de Meta en tu sitio web y los eventos de la app para celulares en tu app para Android y app para iOS. Obtén más información sobre los eventos estándar y los eventos personalizados.
Evento | Cuándo se debe activar | Código de ejemplo |
---|---|---|
Search | En la página de resultados de búsqueda de destinos | |
ViewContent | En la página de detalles del destino | |
InitiateCheckout | Cuando el usuario ingresa en la pantalla de pago | |
Purchase | En la página de confirmación de la compra |
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 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 });
// 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 });
// 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 });
// 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 });
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 // 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 );
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 );
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 );
// 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 );
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: 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 } ];
// 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 } ];
// 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 } ];
// 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 } ];
En el celular, los nombres de los parámetros no son iguales que en el píxel de Meta. 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 en formato JSON: '["value1", "value2"]'
. No concatenes los valores con una coma.
Nombre y tipo de parámetro | Descripción |
---|---|
Tipo: cadena | Recomendado. La fecha de inicio del viaje de un usuario. Aceptamos fechas en los formatos Ejemplos:
|
Tipo: cadena | Recomendado. La fecha final del viaje de un usuario. 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 vector de cadenas | Recomendado. Si se envía, 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 en el caso de Proporciona 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: cadena | Número de adultos que viajarán. Cuando se proporciona, puedes usarlo en el anuncio mediante etiquetas de plantillas. Ejemplo: |
Tipo: entero | Número de niños que viajarán. Cuando se proporciona, puedes usarlo en el anuncio mediante etiquetas de plantillas. Ejemplo: |
Tipo: cadena o cadena[] | Una lista de identificadores que representan sugerencias de destinos para el usuario. Este parámetro no es aplicable para el evento Ejemplo: |
Tipo: valor en punto flotante | Obligatorio para la compra. Precio total de la reserva (número que cuantifica el valor del evento para el anunciante). Ejemplo: |
Tipo: cadena | Obligatorio para la compra. Divisa del valor. Se especifica usando el formato de divisa ISO 4217. Ejemplo: |