Pixels and Custom Conversion Tracking

SamCart allows you to embed tracking scripts and track custom conversions for all of your products. While this setup is highly configurable, it can be complicated to set up. If you prefer to set up your pixels manually, continue reading the instructions in this article! However, thankfully we do have much easier options for tracking your sales to Meta, Google Analytics, or Google Tag Manager. 

Click the link to "Meta Pixel Conversion Tracking" below to skip the manual pixel embed process and go right for the built-in, easy Meta pixel integration SamCart has!

Meta Pixel Conversion Tracking

Embed Your Pixel On All Checkouts

Start by grabbing any code snippets that need to be embedded on your SamCart Checkouts. Once you have the scripts, head to your Marketplace Settings in your SamCart Dashboard. Then click on the Tracking and Pixels tab. 

Then paste your scripts in the Embed HTML/Scripts in Header box. 

You can feel free to add multiple scripts into these boxes. Just make sure each new script starts on a new line, and doesn't overlap with another script. 

Whenever you are done adding, press Save Changes at the top of the page.

Whatever scripts you enter into this box will be added to the header of every checkout you create. This saves you time installing the pixel on every separate Product Page!

You can open one of your SamCart checkouts, and confirm the pixel is rendered on the page by looking at the source code. 

Tracking Sales Conversions

Now that your pixel is added to each page, you will want to set up events that fire when a purchase is made. To do this, you can add custom conversion scripts to each product's settings. 

Specifically, each SamCart product has a box under it's Advanced tab Fire Pixels/Scripts After An Order is Completed. Any scripts added here will be rendered when this product is included in a purchase.


If you are using Order Bumps or One Click Upsells, your customers can have multiple products included in their order. So you may wish to open multiple products and place a different custom conversion script into this box for each product. 

The specifics of how you track your sales will vary, but keep in mind that you can use this box for any product you create. If that product is included in an order, SamCart will fire the scripts you add here. 

Adding Extra Data With Short Codes

SamCart provides a number of short codes you can use to put extra data about your customer, how much they spent, what they purchased, and more into your custom scripts. You can see this in action in the screenshot above, where this customer added the specific product name (##product_name##), product price (##product_price##), and more.

Here is a list of the short codes you can use in your custom scripts...

##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, this custom conversion event from VWO...

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

Could instead have SamCart dynamically add the total each customer spends by replacing 100 with the ##total_amount## short code...

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

Thank You Page Redirect

Whether you choose to direct your customer to the SamCart Order Summary or your own external Thank You Page after checkout can impact your custom conversion tracking.

If you choose to send your customers to an external thank you page (aka not use the SamCart Order Summary page), then make sure you visit your Marketplace Settings and turn the "Fire Pixels Before Redirect" toggle on.

This will make sure SamCart renders your conversion scripts before sending your customers to your custom thank you page. 

Test Your Custom Conversions

Once your conversion tracking is set up how you like it, toggle your product into Test Mode and place a test order. While no money will be charged, SamCart will fire any events you have set up just like they would for a real customer.

Passing Order Information With Javascript

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"
}
  ]
}


Frequently Asked Questions

Q: My pixel isn't showing up on my checkouts.

A: Make sure you have saved your changes, and disable any ad blocker that could be effecting the scripts you've added.  

Q: What is the URL of the page that my customer will be sent to after they order?

A: If you need the URL of the SamCart Order Summary Page for your own conversion tracking you can rebuild it with some information from your SamCart Marketplace. That URL's structure is https://MARKETPLACENAME.samcart.com/order_summaryOpen any SamCart checkout and replace "MARKETPLACENAME" in that URL with whatever you see in your checkout page URLs. 

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

A: Most customers will choose to add a custom purchase event to each product included in a checkout. SamCart will then fire the custom scripts for any product included in an order - meaning one order with multiple products included could fire multiple custom conversion scripts. The specifics of this setup are up to you. Feel free to ask us questions!

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

A: Custom conversion tracking usually is. If you're working with Meta/Facebook or Google, please feel free to skip this tutorial and go right for our more "done for you" conversion tracking integrations outlined in our Meta Pixel Tracking support article! 


Did you find it helpful? Yes No

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