Facebook Conversion API

The Facebook Conversions API provides "server side" tracking from SamCart directly back to your Meta Ads Dashboard. This direct link has some advantages over SamCart's Meta Pixel integration

Our current recommendation is to not use the Conversions API alongside the Meta Pixel Integration linked to above. The risk is that the on-page pixel could report a sale, and that same sale is reported again to Meta from SamCart's servers.

Meta claims to do a good job of "de-duplicating" any orders that would be sent twice. So curious users are free to turn on the Conversions API alongside the Meta Pixel integration. But please be watch your sales closely in Meta, and be on the lookout for duplicate orders being reported. 

Setup With The Integration Engine

Connecting with the Facebook Conversions API is done via the SamCart Integration Engine. To setup the integration, visit your Meta Events Manager Dashboard and copy your Meta Pixel ID.

Next, you will need to generate a API Access Token inside of Meta. To do this, go to the Meta Events Manager. In an existing Meta Pixel, go to Settings and scroll down to Conversions API. 

Click Generate access token to expose a one-time access token for the API.

Now head to your SamCart Marketplace Settings. Visit the Integrations Tab. 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. 

<script>
 fbq('track', 'Purchase', {
   content_name: "samcart_purchase",   
   value: ##total_amount##,
   currency: 'USD'
}, {
   eventID: '##event_id##'
 });
</script>

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>
  !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.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', 'XXXXXXXXXXXXXX', { 
})
 fbq('track', 'Purchase', {
   content_name: "samcart_purchase",   
   value: ##total_amount##,
   currency: 'USD'
}, {
   eventID: '##event_id##'
 });

</script>
<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.