Le inserzioni per gli hotel utilizzano quattro eventi. Ogni evento ha una raccolta di parametri (lista completa in Dettagli dei parametri degli eventi). Usa il Pixel di Facebook nel tuo sito web e gli eventi nell'app mobile nella tua app per Android e nella tua app per iOS.
Evento | Attivazione consigliata | Esempio di codice |
---|---|---|
Search | Sulla pagina dei risultati di ricerca dell'hotel | |
ViewContent | Sulla pagine delle informazioni dell'hotel | |
InitiateCheckout | Quando l'utente accede alla schermata di pagamento | |
Purchase | Sulla pagina di conferma della prenotazione |
Questa guida parte prevede che tu abbia già installato un pixel di Facebook. Se non lo hai fatto, consulta Uso dell'API Marketing con il pixel.
Assicurati che il codice di base del pixel sia già caricato quando attivi un'azione. Se usi uno strumento di gestione dei tag, accertati di inserire il tag contenente il codice pixel in ogni pagina. Il tag deve essere visualizzato prima del tag che contiene il codice azione del pixel. Usa Facebook Pixel Helper per convalidare l'implementazione del tuo pixel.
// 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' });
Questa guida richiede l'implementazione dell'SDK di Facebook nella tua app mobile per Android. Se non hai eseguito l'implementazione, consulta SDK per Android. Se usi un partner di misurazione, assicurati che passi le azioni richieste 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 );
Questa guida richiede l'implementazione dell'SDK di Facebook nella tua app mobile per iOS. Se non hai eseguito l'implementazione, consulta SDK per iOS. Se usi un partner di misurazione, assicurati che passi le azioni richieste 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 } ];
Su mobile, i nomi dei parametri sono diversi rispetto al pixel di Facebook. Spesso, il nome del parametro inizia con fb_
con alcune eccezioni, quali content_ids
rispetto a fb_content_id
, value
rispetto a _valueToSum
.
Quando invii più valori (ad es. con content_ids
o content_type
) fornisci un array di valori JSON codificati: '["value1", "value2"]'
. Non concatenare i valori con una virgola.
Nome e tipo di parametro | Descrizione |
---|---|
tipo: stringa | Vivamente consigliato. La data in cui l'utente desidera effettuare il check-in, espressa nel fuso orario dell'hotel. Accettiamo date in Esempi:
|
tipo: stringa | Vivamente consigliato. La data in cui l'utente desidera effettuare il check-out, espressa nel fuso orario dell'hotel. Per la data accettiamo gli stessi formati elencati per la |
tipo: stringa o stringa[] | Consigliato per Qualsiasi ID rilevante riportato nel catalogo dei viaggi, ad esempio per l'evento Esempi:
|
tipo: stringa o stringa[] | Consigliato. Deve essere |
tipo: stringa | Obbligatorio per Indica la città del luogo dalle intenzioni dell'utente. Esempio: |
tipo: stringa | Obbligatorio per Indica stato/distretto/area geografica del luogo dalle intenzioni dell'utente. Esempio: |
tipo: stringa | Obbligatorio per Indica il Paese del luogo dalle intenzioni dell'utente. Esempio: |
tipo: float | Obbligatorio per Prezzo totale della prenotazione (numero che quantifica il valore di questo evento per l'inserzionista). Esempio: |
tipo: stringa | Obbligatorio per Valuta per il Esempio: |
tipo: stringa o stringa[] | Se hai un catalogo di destinazioni, puoi associare una o più destinazioni nel catalogo con un evento specifico relativo agli hotel. Ad esempio, puoi associare un particolare hotel a un museo o a una spiaggia nelle vicinanze, presenti nel catalogo delle destinazioni. Esempio: |
tipo: float | Un indicatore che rappresenta il valore relativo di questo hotel per l'inserzionista rispetto agli altri hotel. Esempio: |
tipo: stringa | Numero di adulti presenti nel soggiorno. Se fornito, puoi usarli nell'inserzione mediante i modelli di tag. Esempio: |
tipo: int | Numero di bambini presenti nel soggiorno. Se fornito, puoi usarli nell'inserzione mediante i modelli di tag. Esempio: |
tipo: stringa[] | Una lista di quartieri preferiti per cui l'utente ha applicato un filtro. Esempio: |
tipo: [int (min), int (max)] | Una tupla di tariffe minime e massime per le camere per cui l'utente ha applicato un filtro. Esempio: |
tipo: [int (min), int (max)] | Una tupla di stelle minime e massime per l'hotel per cui l'utente ha applicato un filtro. Esempio: |
tipo: float | Un indicatore che rappresenta il valore relativo dell'utente per l'inserzionista. Esempio: |