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. 

1. 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.

2. 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 setup 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 to Step 3 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: 

You are ready to move onto the next step! 

3. 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

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.

4. 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: 

fbq('track', 'Purchase', {
content_name: 'Facebook_Test',
value: 1.00,
currency: 'USD'
});
</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:

5. 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. 

6. 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, the more products you add, the more this data could only 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 setup 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"
    }
  ]
}
B
Breanna is the author of this solution article.

Did you find it helpful? Yes No

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