Facebook Conversion API

Track your Facebook Ads performance with Facebook Conversions API

In addition to using Facebook Pixels, you can now measure ad performance with Facebook Conversions API!

With the iOS14 updates, it has become more difficult to track ad performance through pixels, however, with the Facebook Conversions API you’ll be able to easily continue to track your ads.

Let’s walk through setting up your Facebook Conversion API!
You will integrate with Facebook using the Integration Engine. There will be more information on this further down the article. 

1. Copy Facebook Pixel ID

To copy your Pixel ID, go to Facebook Events Manager. In an existing Facebook Pixel, go to Settings > Pixel ID. Clicking the Pixel ID will copy it to your clipboard.

For more information on creating a Facebook Pixel check out our support article here: Facebook Pixels and Custom Conversions

2. Generate a Facebook Conversion API Access token

To generate your API Access Token that is also necessary to complete the Facebook Integration, go to Facebook Events Manager. In an existing Facebook Pixel, go to Settings and scroll down to “Conversions API”. Clicking “Generate access token” will expose a one-time access token for the API.

3. Integrate with Facebook

Now that you have gathered your Facebook Pixel ID and API Access token you can proceed to integrating SamCart with Facebook! To do so, navigate to the Integrations tab inside your General Marketplace Settings and click on the New Integration button.

In the Integration Popup you will see the option to select Facebook in the dropdown:
After selecting Facebook click the Next Step button. On the next page in the Integration Popup you’ll then add your Facebook Pixel ID and API Access token:

After entering in the necessary information click on Save Integration to finish connecting with Facebook!

4. Setting Up the Integration Trigger

The last step in setting up your Facebook Conversions API is to set up your integration trigger. To do so, navigate to the Global Rules tab in your Integrations screen and click on New Rule:

The only integration trigger available with Facebook is Product Purchased. In the New Rule popup you’ll want to select eCommerce and Product Purchased as follows:

On the next page of the integration rule pop up, in the Integration dropdown select Facebook and in the Action dropdown select Track Conversion Event:

You have now successfully set up your Facebook Conversions API! 

Back in your saved Integration Rules, the Action may show as "Send a POST for the specified trigger" rather than "Track conversion event." This is correct. 

The recommended implementation for the “Product Purchased” trigger is to implement it globally so whenever a product is purchased (primary product, Order Bump, Upsell) a unique conversion event is sent to Facebook.

To avoid counting an order twice, Facebook recommends adding this small script to your Facebook Pixel. This small addition will automatically enter your customer’s order ID number, and the total value of their order. So Facebook gets even more information, and can help you track every dollar you bring in back to the correct Facebook Ad campaign that found that customer. 

 fbq('track', 'Purchase', {
   content_name: "samcart_purchase",   
   value: ##total_amount##,
   currency: 'USD'
}, {
   eventID: '##event_id##'

However, it is not required to use a pixel in addition to the Conversion API.

As an example, here is what the final pixel would look like after adding in the small script above:

<!-- Facebook Pixel Code --><script>
  s.parentNode.insertBefore(t,s)}(window, document,'script',
fbq('init', 'XXXXXXXXXXXXXX', { 
 fbq('track', 'Purchase', {
   content_name: "samcart_purchase",   
   value: ##total_amount##,
   currency: 'USD'
}, {
   eventID: '##event_id##'

<noscript><img height="1" width="1" style="display:none"
  src="https://www.facebook.com/tr?id= XXXXXXXXXXXXXX&ev=PageView&noscript=1"
/></noscript><!-- End Facebook Pixel Code -->

Take that new pixel and add it to any product you would like to track back to Facebook. Open any product, visit the Advanced tab, and paste this full pixel code into the box labelled "Fire pixels/scripts after an order is completed".

Each time that product is purchased, SamCart will fire this script and pass information back to Facebook, making your campaigns smarter than ever!

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.