Install the Facebook Pixel

The Facebook Business Extension, v1 is currently only available to whitelisted Partners. Please contact your Facebook representative for access.

You get the pixel from the popup and install it where necessary. For example, if Purchase events are done on www.yourstore.com/item1-purchase, you tell the popup which URL feed you will use to communicate it, to populate this product.

Follow these steps to insert the Facebook pixel ID into every page for any given store on your platform:

Step 1: Review the standard events on your platform

For example, see PageView, ProductView, and Purchase events on your platform.

Step 2: Insert the JavaScript code

Insert the JavaScript code to fire the pixel for appropriate events inside those hooks.

The diagram below shows how the pixel requirement was implemented in the plugin. In this specific example, there are two main components:

  • Hooks or callbacks on the front end into front end events that retrieve the pixel ID from your backendsome database or backend store.
  • Backend storage and process Functionality to save the pixel ID into a database when receiving from the Facebook Onboarding Flow popup.

Step 3: Verify the list of pixel events

In order of importance (most to least), they should be listed as Purchase, CompleteRegistration, Lead), InitiateCheckout, AddToCart, ViewContent, Search, ViewCategory, PageView. Learn more about standard and custom events.

Step 4: Verify the content ID

In ViewContent, AddToCart, and Purchase for a specific product, you must fire these events with a specific content ID to enable dynamic ads.

This must be the same content ID you used when you uploaded or created a feed file with that product. You can use the SKU or whatever is available, as long as you ensure consistency between pixel and catalog.

Step 5: Verify the value

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


For specific implementation details and examples, see sample code from the plugin:

Verification

Your implementation may differ slightly from this example. You need to include an agent string in every pixel fire that helps our systems analyze downstream pixel traffic; see example implementation.

The agent hash is the fourth parameter in the init pixel code.

Step 6: Direct users to ads creation

[Optional] After setup is complete, you can direct users to a simple ads creation interface geared towards platform integrations, which Facebook has created to help users boost sales.

  • Using the pixel, the ads created to form this interface are optimized to drive sales to the user.
  • For an example, see the Magento plugin or the WooCommerce plugin.
  • The URL to this interface is http://www.facebook.com/ads/dia/redirect?settings_id. See merchant settings id.