Commerce Guidebook

To provide sellers with a complete Facebook integration, we recommend that commerce platform partners and/or website builders establish their integration following these steps:

This guidebook provides an overview of the Facebook commerce integration blueprint. Best practice recommendations solely to help inform ad campaign strategies; not intended as a warranty or guarantee of results to be achieved. Marketing outcomes depend on a variety of factors and will vary.

Step 1: Seller Onboarding

As a partner, the first step in establishing integration with Facebook is to create an application on developers.facebook.com/apps. You will need the app ID for FBE and/or API integration points.

To effectively use Facebook’s Commerce products, a seller needs to provide or create the following business assets:

  • Business Manager
  • Ad account
  • Page
  • Instagram account
  • Pixel
  • Catalog

To reduce the complexity for our partners, we recommend onboarding sellers via Facebook Business Extension (FBE). FBE is a pop-up based solution, that allows sellers to select or create the aforementioned assets. With FBE:

  • Asset IDs and access tokens are returned to you via web hooks and/or API
  • You are privy to access tokens and asset IDs, as a partner. This way, you can assist sellers with pixel and catalog management, as well as commerce integration.

Please refer to the Facebook Business Extension Guide guide for details on implementation.

As an alternative to FBE, you could invest in a custom onboarding flow leveraging Marketing and Graph APIs. We do not recommend this approach, unless you would like to cover a use case currently not addressed by FBE.

Step 2: Pixel Integration

An automated onboarding process for sellers allows you to enable pixel integration by design. Once you have a seller’s pixel ID, you can install it via JavaScript code.

Once installed, you must fire the Facebook pixel on all standard events supported by Facebook. A few notes on events:

  • Possible events listed in order of importance: Purchase, AddToCart, ViewContent, PageView, InitiateCheckout, Search, ViewCategory, CompleteRegistration, Lead, and more.

  • For ViewContent, AddToCart, and Purchase events related to a specific product, you must add content IDs to the events you fire, in order to enable Advantage+ catalog ads. The dispatched content ID must the same one you used when you uploaded or created a feed file containing that product. You can append your own product IDs with SKUs as long as they are consistent across your pixel and Catalog implementations.

  • For Purchase events specifically, you must pass back the transaction value.

  • Include an agent string in every pixel event to help our systems analyze pixel traffic. You should use this parameters when you initialize the pixel. agent is the fourth parameter in the pixel code and should be formatted as {'agent': 'platform_name-1.0'}, where platform_name-1.0 refers to the name and version of your platform. In the example below, you would need to replace platform_name with the name of your platform keeping the pl prefix.

Example for pixel setup including the agent field:

<!-- Facebook Pixel Code -->
<script>
  !function(f,b,e,v,n,t,s)
  {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
  n.callMethod.apply(n,arguments):n.queue.push(arguments)};
  if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'n.agent=pl<platform_name>';
  n.queue=[];t=b.createElement(e);t.async=!0;
  t.src=v;s=b.getElementsByTagName(e)[0];
  s.parentNode.insertBefore(t,s)}(window, document,'script',
  'https://connect.facebook.net/en_US/fbevents.js');
  fbq('init','<pixel_id>',{<targeting_data>});
  fbq('track', 'PageView');
</script>
<noscript><img height="1" width="1" style="display:none"
  src="https://www.facebook.com/tr?id=<pixel_id>&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code --> 

To provide sellers with better results, we recommend implementing the Conversions API to programmatically send signals from your server. Follow this guide to implement the Conversions API.

Advanced Matching

To improve match rates for signals enabled via your platform, we recommend configuring the pixel to use Manual Advanced Matching by referencing relevant keys . If you cannot set that up initially, we recommend an interim solution, in which you automatically provide advanced matching by setting enable_automatic_matching to true. For example:

curl -X POST \
  -F 'enable_automatic_matching="true"' \
  -F 'access_token=<ACCESS_TOKEN>' \
 'https://graph.facebook.com/<VERSION>/<PIXEL_ID>'

Automatically providing Advanced Matching can help drive lower match rates, compared to providing advanced matching as a manual option. As a best practice, you should have your app configure the pixel code on a seller’s pages on your platform. This can be done once you get a pixel ID from the user.

Learn more about how to install, configure, and implement the Facebook pixel.

Step 3: Catalog Management

After a successful pixel integration, it’s essential to synchronize sellers’ product between your platform and Facebook. You can import the products leveraging the catalog ID acquired as a part of the seller onboarding flow.

Refer to this guide for details on Catalog implementation.

Step 4: Commerce Platform Integration

The Commerce platform enables e-commerce solutions and retailers to deeply integrate their infrastructure with the tools available to sell their products across the Facebook Family of apps, including Facebook Shops, Marketplace, and Instagram Shopping.

Commerce Platform and Facebook Shop capabilities are currently limited to a closed set of partners, so they are not currently covered in this document. Reach out to your Partner Manager to learn more about Commerce integration.