If you're using Facebook Ads, Google Adwords, or other third party tracking tools, you can track purchases by embedding conversion pixels into your SamCart checkout process. 

With SamCart's Smart Conversion Tracking, you can even fire multiple conversion pixels based on each customer's unique order.

You can also tap into a customer's specific order information (some tech skills required) and pass information back to Facebook or Google, like order total, product purchased, and more!

Follow the directions below to embed your own scripts & pixels onto your SamCart checkout pages.

Step #1: Add Scripts To All SamCart Pages

Most tracking tools have a universal tracking script that needs to be placed onto every page a visitor might hit. Facebook has the Facebook Pixel. Google Analytics has their Tracking Code. 

Follow these steps to add a universal script to all of your Marketplace's checkouts, upsells, and order summary pages.

  • Copy the script you need directly from Facebook, Google, etc. and jump into your SamCart Dashboard.
  • From the dropdown menu at the top-right of your dashboard, click on Settings.
  • On the General tab, find the Embed HTML/Scripts box.
  • Paste in any script(s) that you want to display on every checkout, upsell, and order summary page.

Any scripts that you have placed here will now be displayed anytime someone lands on any checkout, upsell, or Order Summary page.

Step #2: Setup Individual Conversion Events

Inside of your tracking tool, create purchase events for each product you sell. Each event you create will provide a unique event pixel that you will need to bring back over to SamCart.

As an example, here is a Facebook event pixel for a product called "SamCart Sweatshirt"...

<script>
document.addEventListener("DOMContentLoaded", function(event) {
fbq('track', 'Purchase', {
content_name: "SamCart Sweatshirt",
value: 19.97,
currency: 'USD'
});
});
</script>  

To make sure this event pixel tracks correctly, I need to go into SamCart, and open the product settings for my "SamCart Sweatshirt" product.

On the Advanced Settings tab, paste the event pixel into the Embed HTML/Script On Order Summary box.

Make sure to click Save Changes when you're done. 

The conversion pixel in that box will be displayed on the Order Summary Page every time this product is purchased. The pixel will display regardless of how this product is purchased: from a checkout page, as an order bump, as a one click upsell.

Repeat these steps for each product you want to track!

Track Sales Value

Depending on what tool you are using to create your event pixels, you have the option to give each event a value. 

In the event above, I gave the event pixel a value of '19.97'. Each time that event fires, Facebook will know that event is worth $19.97 in revenue. 

This is useful for tracking the ROI of your campaigns. So you can see exactly how much revenue each campaign has created.

Alternative: Embed Conversion Pixel On Upsell

There is an alternative way to track sales using conversion pixels. If you are showing customers an upsell after they place an order, you can embed a conversion pixel directly onto any upsell page.

To embed a pixel onto an upsell page, click on the Upsells tab at the top of your dashboard. 

  • Select the upsell your customers will see immediately after placing their order.
  • Scroll down to the Upsell HTML editor. 
  • Click Source to toggle to the code editor.
  • Paste in your script(s) on a new line.
  • Click Source again to toggle back to the visual editor.
  • Click Save Changes at the top of the page.

After this is done, whenever a new customer loads this upsell page, your script(s) will be loaded as well. Conversion pixels fire, and your tracking is all set. 

OPTIONAL Step #3: Adjust Your Thank You Page Settings

If you're using SamCart's Thank You Page Page, your universal tracking script will automatically be embedded there if you've followed the steps above.

If you're using your own Thank You Page, SamCart can automatically fire your pixels before the customer is redirected. Just head to your Marketplace Settings and switch the Fire Pixels Before Redirect (Optional) slider to "ON." 

This can cause a slight delay (usually less than a second). If you'd like to stop SamCart from firing your pixels before the redirect, switch the Fire Pixels Before Redirect (Optional) slider to "OFF." 

Custom Conversion Macros:

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

Frequently Asked Questions

Q: What are tracking scripts, conversion pixels, and all these other crazy words?

A: Third party tools (like Facebook Advertising, Google Analytics, etc.) provide tools that help you track sales conversions that happen in other tools, like SamCart. 

If you want to learn more about what these tools are, and how others are using them, here's an article we find really helpful on the topic.

Did this answer your question?