Implement a pixel and/or mobile SDK for dynamic ads for travel (flights)

30/11/2019
To show dynamic ads to people who visited your website or mobile app, you will need to implement the Facebook pixel on your website and/or the Facebook SDK in your mobile app. The pixel and SDK let Facebook know who to deliver your ads to based on the actions they've taken, such as viewing a specific flight or entering payment information.

Set up or modify your pixel

If you've never set up a pixel: create and add to your website

Create a Facebook pixel

  1. Go to your Pixels tab in Events Manager.
  2. Click Create a Pixel.
  3. To finish creating your pixel, click Create in the box that appears.

Add the Facebook pixel to your website

Once you've created your pixel, you're ready to put the Facebook pixel code on your website. Choose the statement below that best fits how you make updates to your website's code for instructions:

Someone else makes changes to my website

If someone else updates the code in your website, then follow the steps below to email them instructions to set up the Facebook pixel on your site.

  1. Go to the Pixels tab in Ads Manager.
  2. Click Set Up Pixel
  3. Click Email Instructions to a Developer.
  4. Enter the recipient's email address.
  5. Click Send at the bottom of the page.
I update my website's code
  1. Locate the header code for your website
  2. Go to your website's code and find the header of your website.

  3. Copy the entire code and paste it in the header of your website
  4. Paste the code at the bottom of the header section, just above the closing head tag.

  5. Check that your code's working correctly
  6. Click Send Test Traffic after placing the code on your website to make sure your pixel's working properly. If your status says "Active", your base code has been installed correctly. This can take several minutes to update.

My site uses a tag manager or is hosted on a popular website platform

Select your platform or tag manager from this list for an even easier way to set up your pixel. If you can't see your platform here, then take a look at one of the other two ways of setting up your pixel above.

Website platforms:

Tag managers

Learn more about the benefits of using a third-party platform to set up your pixel.

Now that your pixel is set up, let's customise it for destinations by modifying the pixel on key lower-funnel pages.
If a pixel is set up on your website: modify on key lower-funnel pages

In order to retarget customers at different stages of your purchase funnel, you must modify the Facebook pixel on selected pages. In addition to the code installed on all pages of your website, dynamic ads for travel requires four custom data events to be added to different pages of your website. Work with your web developer to modify the Facebook pixel for each of the following pages:

Search results pages

You'll want to add your pixel to search results pages on your site and track the Search event.

After adding your code, make sure that you use Pixel Helper to get real-time feedback on the implementation of your pixel and whether or not it's firing properly.

Product pages

You'll want to add your pixel to product pages on your site and track the ViewContent event.

After adding your code, make sure that you use Pixel Helper to get real-time feedback on the implementation of your pixel and whether or not it's firing properly.

Checkout pages/"Check Out" buttons

You'll want to add your pixel to checkout pages and "Check Out" buttons on your site and track the InitiateCheckout event.

After adding your code, make sure that you use Pixel Helper to get real-time feedback on the implementation of your pixel and whether or not it's firing properly.

Booking confirmation pages

You'll want to add your pixel to checkout pages and "Check Out" buttons on your site and track the Purchase event.

After adding your code, make sure that you use Pixel Helper to get real-time feedback on the implementation of your pixel and whether or not it's firing properly.

The standard events mentioned above must be added exactly as described below, with no variations in spelling or case. Make sure that you're looking at the standard events for the type of inventory that you're using; in this case, you'd use the standard events for flights.

PageEvent nameRequired parametersRecommended parameters
Edit your search results pages to capture flights resulting from people's searches on your website.Searchcontent_type, departing_departure_date, returning_departure_date (required if you have a return journey), origin_airport, destination_airportdestination_ids, departing_arrival_date, returning_arrival_date, num_adults, num_children, num_infants, travel_class, user_score, price, purchase_currency, preferred_num_stops
Edit your product pages to capture flight details for the specific flight and itinerary that a person has selected.ViewContentcontent_type, departing_departure_date, returning_departure_date (required if you have a return journey), origin_airport, destination_airportdestination_ids, departing_arrival_date, returning_arrival_date, num_adults, num_children, num_infants, travel_class, user_score, price, purchase_currency, preferred_num_stops
Edit your checkout pages to capture the flight details that a person selected when they began the checkout process.InitiateCheckoutcontent_type, departing_departure_date, returning_departure_date (required if you have a return journey), origin_airport, destination_airport destination_ids, departing_arrival_date, returning_arrival_date, num_adults, num_children, num_infants, travel_class, user_score, price, purchase_currency, preferred_num_stops
Edit the booking confirmation page to capture which flight has been purchased.Purchasecontent_type, departing_departure_date, returning_departure_date (required if you have a return journey), origin_airport, destination_airport, value, currencydestination_ids, departing_arrival_date, returning_arrival_date, num_adults, num_children, num_infants, travel_class, user_score, price, purchase_currency, preferred_num_stops

Refer to the developer site for definitions and additional formatting requirements for pixel parameters.

Using a tag management partner

Many tag management providers have integrated with Facebook to make it easier to set up Custom Audiences from your website and dynamic ads. Please contact your tag management partner directly to learn how to modify your tag to work with Facebook dynamic ads. You can also place the Facebook pixel code directly on your site.

Verify your pixel implementation

We suggest two primary tools for verifying that your pixel has been set up correctly to use dynamic ads:

Facebook Pixel Helper

The Facebook Pixel Helper helps you to confirm that your Facebook pixels are working as expected. Learn how to install the Facebook Pixel Helper.

Using Pixel Helper, you can confirm if a Facebook pixel has been added to your website, what standard events are on which pages (e.g. Event ID: ViewContent) and which content_ids are being reported by clicking View Event Log.

Common issues uncovered while testing your pixel

  • Matching your catalogue to your Facebook pixel: If you receive an error stating that the pixel couldn't find a catalogue, you will need to fix your event sources in the catalogue settings. Associating your pixel or app tells Facebook which pixel or app will match which catalogue. To associate your pixel, navigate to the Settings page in Business Manager, click Product catalogues, select your catalogue and click Associate Sources. Select the pixel or app that you would like to map to this catalogue. If a different team member created the catalogue and then placed the Facebook pixel, you may need to grant admin access (required) to add/update a catalogue's settings.
  • Matching IDs used in feeds and pixels or SDK: If you receive errors stating that products didn't match, it is likely that the product IDs being sent via the pixel for content_ids didn't match products in your catalogue. The content ID reported from the Facebook pixel must be exactly the same as the corresponding ID column from the catalogue.
  • Associate your pixel with your catalogue: If you've set up your dynamic ad for travel and there is no spend going through, double-check that you've associated an event source group (the pixel) with your catalogue.
      To do this:
    1. In the assets menu, click on Product catalogues Select your catalogue
    2. Click on Catalogue settings in the top menu
    3. At event sources, click on Edit
    4. Assign pixels and apps to your catalogue

Retargeting Pixel Debug Tool

The Retargeting Pixel Debug Tool helps you to debug the issues specifically related to retargeting. Once you've entered the pixel ID, the tool will report all of the Search, ViewContent, Purchase and InitiateCheckout events.

You can also use this tool to see all events fired for your user ID for the specified pixel ID. So you can visit a product page on your website that fires pixel events for the specified pixel ID and double-check if those pixels fired have been registered correctly when you visited that page.

Furthermore, to understand retargeting audiences, this tool allows you to enter an audience ID and check whether you are included in that audience to make sure that the audience rules are set up correctly and that you are being correctly matched to the right audiences.

Try out the Retargeting Pixel Debug Tool in Business Manager.

Implement the Facebook SDK for your mobile app

Starting with the Facebook SDK

You need a Facebook App ID to use the Facebook SDK for iOS, Android or JavaScript (web). You can use an existing app if you already have one. If you do not have an existing app, use our Quick start to create a new one. If you need help, follow our guide on how to register and configure an app.

You will need to add the SDK to your app. Learn more in our getting started guide.

Prior to adding the SDK to your app, read the section below to also integrate the required app events for dynamic ads.

Setting up app events on key lower-funnel pages

To dynamically retarget your app users with relevant products, the same four required events must be added to your app.

EventApp event
Searchfb_mobile_search
ViewContentfb_mobile_content_view
InitiateCheckoutfb_mobile_initiated_checkout
Purchasefb_mobile_purchase

For more details on adding these four custom data events, visit our developer site.

Verify your app events

To ensure that your app events are being sent correctly, you can check your recent events in Facebook Analytics for Apps.

Connect your pixel to your catalogue
Set up a catalogue
Learn how to set up a catalogue for dynamic ads for travel (flights) by uploading a regular data feed or by using a feed-less solution. This is a necessary step for completing this ad format. Once you have a catalogue set up, continue with the steps below to connect your pixel.

Note: If you use the feed-less solution to set up your catalogue, the catalogue will automatically be populated using pixel activity.

Associate an event source group (pixel) with your catalogue

After you've added your pixel and events, you need to associated an event source group (the pixel) with your catalogue. If your setup includes multiple catalogues and pixels, make sure that you properly connect the right pieces together. You can match the pixels with the corresponding travel catalogue through Facebook Business Manager:

  1. In the assets menu, click on Product catalogues
  2. Select your catalogue
  3. Click on Catalogue settings in the top menu
  4. At event sources, click on Edit
  5. Assign pixels and apps to your catalogue

Complete your dynamic ad for travel (flights):

Create an ad template

* Nguồn: Facebook