Facebook Pixels and Custom Conversions


You can't manage what you can't measure. Analyze your Facebook Ads performance with Facebook Pixels and Custom Conversions.

If you're running Facebook Ads traffic to your SamCart Product Pages, having insight into how your Ad dollars are working for you is critical to success. Thankfully, Facebook Ads Manager gives you all the tools you need to gauge Ad performance, and SamCart works seamlessly with these tools. 

The two main components are Facebook Pixels and Custom Conversion events. We'll discuss both below and break down how to get them working with your SamCart Marketplace. 

Embedding your Facebook Pixel(s)

The Facebook Pixel is code that you place on your SamCart Product Pages. It collects data that helps you track conversions from Facebook ads, optimize ads, build targeted audiences for future ads, and remarket to people who have already taken some kind of action on your page.

If you don't already have one, you'll need to create a Pixel. 

To begin, head to your Facebook Events Manager. NOTE: This is the same whether you're using a Business Account or Personal Account for Facebook Ads.

Click the Connect Data Sources button on the left side menu:

Select Web and press Get Started:

Select Facebook Pixel and press Connect:  

The next box will prompt you to name your pixel and Continue

Next, choose the option to Install code manually:

From there, you will be able to copy your pixel script to place on your SamCart marketplace's General Settings.

If you already have a Pixel, click the Add Events dropdown and select From a New Website to copy your base pixel script: 

Once you've copied it, head to General Marketplace Settings in your SamCart Dashboard and paste your script in the Embed HTML/Scripts in Header field. Press the Save Changes button afterward. This field (along with everything else on this page) is global, meaning it applies to all your Product Pages. This saves you time installing the pixel on every separate Product Page! 

It should look something like this:

And you're done! Your Facebook Pixel is now installed on all of your SamCart Product Pages. Preview one of your checkout pages to "activate" the pixel. It may take a few moments but the Facebook Events Manager will reflect the pixel as Active. That means you are all set! You will not need to install that pixel script again.

Creating a Custom Conversion Event Script in Facebook

You can use Custom Conversion Event Scripts to send detailed purchase data back to Facebook from SamCart. This helps you track exactly which SamCart purchases are a result of your Ad(s). Facebook has detailed information about Custom Conversions here: https://www.facebook.com/business/help/780705975381000

For the examples here, we will use a common type of Custom Conversion called a Purchase Event. This sends data back to Facebook on the value of the purchase. First you'll need to decide what kind of script to use - Static or Dynamic

Static Purchase Events send a standard dollar value to Facebook. So, if the Product is $30, the Static Purchase Event will send that $30 total to Facebook. If the price may alter due to factors like Coupons, Quantity fields, or Shipping charges, you'll want to use a Dynamic Purchase Event. This passes along the price calculated at checkout, resulting in more accurate data.

To set up either type of Purchase Event, head to Facebook Events Manager and select Custom Conversions from the left menu. Then press the Create Custom Conversion button.

You'll be prompted with a screen to Create a Custom Conversion with a few fields:

Here are the fields you need to fill out:

  1. Name the Conversion
  2. Confirm the Data Source is the correct pixel if you have multiple.
  3. Select Purchase as the Conversion Event. If you do not see Purchase listed, skip ahead and install the event script on your SamCart checkout page and run an order while in Test Mode. This will open up the Purchase parameter, so it will populate in the dropdown inside the Facebook dashboard.
  4. The URL for the Purchase Event will be part of the URL from the Order Summary page a customer lands on after completing a purchase on the checkout page. You use this URL as this event should only fire if the customer makes a successful purchase. Here is the order summary URL you should use: https://MARKETPLACENAME.samcart.com/order_summary (Replace the MARKETPLACENAME portion with your SamCart Store URL.) If you are using a Custom Domain for your SamCart checkout page, you will want to adjust the order summary URL. So if your domain is www.example.com the order summary URL will be www.example.com/order_summary
  5. If this is a Static Purchase Event, you will enter the Product Price. If this is a Dynamic Purchase Event, leave this box checked and the field blank.

After you fill out the info and press the Create button, you will see the Purchase Event in the Custom Conversions section of your Facebook Events Manager: 


Installing a Custom Conversion Event Script in SamCart

Now that our event is created, we need to install it on our SamCart Product Pages. These steps will be different depending on whether you are using a Static Purchase Event or Dynamic Purchase Event

Note: We recommend adding purchase scripts for each specific product you'd like to track in its Advanced Settings > Fire pixels/scripts after an order is completed. This will result in the pixel firing every time a purchase is completed. If it is added to the General Marketplace setting, it will fire every time a sales page is visited and there will appear to be more sales than there actually are. 

Static Purchase Event

If you are using a Static Purchase Event, head to the Advanced Settings tab of your Product and place the following script in the Fire pixels/scripts after an order is completed field and click Save Changes:

Here is the script to use: 

<script>
fbq('track', 'Purchase', {
value: 30.00,
currency: 'USD',
});
</script>

Please note: both the Value and Currency should be changed to reflect the Product Price and Currency it is in. Do not add any dollar signs or other symbols to the value.

Dynamic Purchase Event

If you are using a Dynamic Purchase Event, head to the Advanced Settings tab of your Product and place the following script in the Fire pixels/scripts after an order is completed box. 

Here is the script to use: 

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

Please note: the Currency should be changed to reflect the Currency used for your marketplace. Do not add any dollar signs or other symbols to the script.

Alternative Way to Setup your Pixel & Custom Conversions

If you have Order Bumps and One Click Upsells on your SamCart pages, you might want to track products individually in the Facebook Events Manager. You can do this through an alternative Facebook Custom Conversion setup explained by Brian Moran here in a YouTube tutorial: 

In the video, you will see a script you paste into the Advanced Settings tab of your product's settings. It is a combination of your base pixel script and a custom conversion one. 

Here is the sample Purchase Event custom conversion script - adjust the value, currency, and content_name for your product: 

<script>
fbq('track', 'Purchase', {
value: 30.00,
currency: 'USD',
content_name: 'facebook_test',
});
</script>

Paste that script snippet under the PageView line (Under Line 12) of your own pixel just like this: 

<!-- 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', '323353768851001');
fbq('track', 'PageView');
fbq('track', 'Purchase', {
value: 1.00,
currency: 'USD',
content_name: 'Facebook_Test',
 });
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=323353768851001&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->

After the pixel script is put together, you will add it to the Fire pixels/scripts after an order is completed field inside the Advanced Settings tab at the product level. Save changes after pasting, and that's it!

When you create the Custom Conversion inside Facebook's dashboard, you may first need to run an order while in Test Mode with the pixel script above embedded on the product page. This will open up the Event Parameters inside the Facebook dashboard, so it populates in the dropdown for this next step. 

Once the test runs and it populates, you can create a Custom Conversion inside the Facebook dashboard to track. In the Rules section, you will select Event Parameters, content_name, and equals. Then you will type the content_name you are using in the field and press enter. Note the consistency in the content_name event parameter in both the script and custom conversion setup ("Facebook_Test"). It must be the exact same in both places in order to track correctly:

Thank You Page Redirect

Whether you choose to direct your customer to the Order Summary or a Thank You Page URL after checkout could potentially impact your pixel and custom conversion, so keep it in mind during setup. 

There are two options within the Purchase Completion section of the General Marketplace Settings

The first option is Display Summary Page With Redirect Links. If you selected this option, an automatically generated Order Summary page will show up after a successful order. There are no additional steps to take to ensure the custom conversion fires. 

The second option is Redirect To Original Product Redirect URL. If you selected this option, an additional field will populate that says Fire Pixels Before Redirect (Optional). This toggle should be set to ON in order to successfully fire any custom conversions. 

Testing Tools

Now that you have set everything up, you will want to test everything! 

Please check out our article on Test Mode to learn how to place an order without using a real credit card. 

You can do this by running a Test Order on the Product with the conversion and using the following tools: 

Facebook Pixel Helper

Facebook Pixel Helper is an extension for the Chrome browser that helps you to see if the pixel is working properly. 

There are directions to install it on Facebook's support site here: https://www.facebook.com/business/help/1700857106877546

After installing Facebook Pixel Helper, you can go to your Product Page, and Preview it to verify the Pixel is reading. You will notice that the Page View is read, but there is a little yellow caution sign near the Purchase event. This is normal. The Purchase event will only fire if an order is completed, so while it is on the page, there are no actions firing (outside Page View) until the Submit Order button is pressed. 

After completing a Test Mode order, you will see the Facebook Pixel Helper reflects the Purchase Event data has been sent over: 

Test Mode

Another fantastic way to ensure everything is firing correctly is to Test Events in your Facebook Events Manager. To use this tool, open up your SamCart Product Page in a separate tab, and the Pixel will start sending information to Facebook. You can place a Test Mode order on the page and see if there are any errors that populate as the events fire. 

Frequently Asked Questions

Q: My pixel doesn’t work. 

A: Keep in mind, there is sometimes a delay for events reflecting in your Facebook dashboard. The best way to confirm where the issue is would be to use once of the testing tools. If you do not see the Pixel or Custom Conversion in the Facebook Pixel Helper tool, the coding may be missing or in an incorrect place. 

Q: My pixel is working. Where is my data in the Facebook dashboard?

A: There is an Analytics option under the Analyze and Report section in the Facebook dashboard dropdown. This will contain the data from the Pixel and Custom Conversion events:

Q: How does it work with an Order Bump or Upsell? 

A: If the Custom Conversions is setup on the product connected to the Order Bump or Upsell, you are good to go! Those Custom Conversions will only fire if the customer opts in.

Q: This is complicated, do I need to set this up?

A: This is completely up to you. The bigger your business grows, and the more products you add, the more this data could help!

This article contains more information on why the data may be helpful to future marketing efforts: https://www.digitaland.tv/blog/what-is-tracking-pixel-ht/

Q: Can you help me set up a Facebook ad? 

A: SamCart Support isn't authorized to make recommendations or offer support on Ad creation, Ad copy, Ad optimization, or Ad spend.

If you are looking for more in-depth training, please check out Brian Moran's course called Facebook Ads Academy. Facebook also offers additional training on their support site: https://www.facebook.com/business/learn

Q: Can I send over more data from the Order Summary page to Facebook for tracking? 

A: If you'd like to pass even more information in your conversion event, add any of the following macros to your script in your Product's Fire pixels/scripts after an order is completed field, which is found under the Advanced Settings tab:

##first_name##         
##last_name##
##customer_name##
##email##                
##phone_number##    
##product_id##            
##product_quantity##
##product_name##  
##product_price##    
##product_total##    
##order_id##            
##total_amount##    
##total_shipping##  
##total_tax##        
##currency##

For example:

<script type="text/javascript">
    window.VWO = window.VWO || [];
    window.VWO.push(['track.revenueConversion', "997"]);
</script>

Can become: 

<script type="text/javascript">
    window.VWO = window.VWO || [];
    window.VWO.push(['track.revenueConversion', "##total_amount##"]);
</script>

Passing Order Information

If you want to get really advanced with tracking, you can tap into your customer's order information by exposing the javascript variable, 'order_summary' on the Order Summary Page.

That will expose the following info about each customer's order. This info can be used to pass back even more information with your tracking.

{
  "id": 41,
  "created_at": "2018-02-13 17:13:12",
  "total": "186.95",
  "shipping": "0.00",
  "tax": "0.00",
  "items": [
    {
      "type": "product",
      "product_id": 11,
      "product_name": "Great Product",
      "amount": "37.00",
      "quantity": 1,
      "source": "primary"
    },
    {
      "type": "product",
      "product_id": 13,
      "product_name": "Amazing Product",
      "amount": "100.00",
      "quantity": 1,
      "source": "bump"
    },
    {
      "type": "product",
      "product_id": 17,
      "product_name": "Incredible Product",
      "amount": "49.95",
      "quantity": 1,
      "source": "upsell"
    }
  ],
  "customer": {
    "first_name": "John",
    "last_name": "Doe",
    "email": "john@samcart.com",
    "phone": "4438675309"
  },
  "billing_address": null,
  "shipping_address": {
    "address_line_1": "11850 West Market Place, Suite C",
    "address_line_2": null,
    "city": "Fulton",
    "region": "MD",
    "postal_code": "20759",
    "country": "USA"
  },
  "custom_fields": [
    {
      "name": "Shirt Color",
      "slug": "custom_ktJxqg9M",
      "value": "Midnight Blue"
    },
    {
      "name": "Shirt Size",
      "slug": "custom_StyspC0l",
      "value": "XL"
}
  ]
}

Q: How do I verify my domain within Facebook?

A: In order to run Facebook ads to a page built with SamCart, you need to verify the custom domain you’re using for your page.


First, you need to set up your own SamCart Custom Domain by following our instructions here. 

You now need to verify your domain using Facebook’s DNS Verification process, which will require you to put a TXT file in your DNS settings in your domain registrar. 

This process requires the verification script from Facebook!

Here is how you will want to correctly grab that script:

  1. Navigate to your Meta/Facebook Business Setting's Brand Safety  drop-down menu, and click on Domains
  2. Click the Add button and type in your root domain (e. example.com)
  3. Make sure that you have the Update the DNS TXT record with your domain registrar option selected
  4. You can now find the verification script to add this TXT record in your DNS hosting provider

Once you log into your domain registrar, you will need to navigate to the domain you’re trying to verify. Then you will want to:

  1. Go to the screen within your domain registrar where you can manage this domain's DNS records
  2. Add a TXT record
  3. Type the @ symbol into the Name/Host field
  4. Paste the verification script from Facebook (as explained above) into the Answer/Content field (i.e. “facebook-domain-verification=xxxxxxxxxxxxxx”)
  5. Click Save

This record will look something like the following:

After a few minutes, you can go back to Facebook and verify the domain by clicking the green Verify button!

This will allow that domain to appear under Facebook's Web Event Configurations page, enabling you to assign up to 8 Facebook ad conversion events that your ads can be optimized towards.

Q: Why is the order total showing for each individual product on Facebook?

A: When you have multiple items in a cart, we will always send over the cart's order total for each individual product. This occurs regardless of whether the pixel is dynamic or static.

Did you find it helpful? Yes No

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