Add conversion tracking to your order status page

You can use conversion tracking to track when your customers visit your checkout and how often they make a purchase. Conversion tracking can help you learn more about purchasing trends on your store, like average order value and total sales per product. There are a few different platforms available that give you access to this data.

Google Analytics conversion tracking

You can use Google Analytics conversion tracking for your checkout. For information about implementing this on your store, read Setting up Google Analytics goals and funnels.

Tracking pixels

You can add tracking pixels to your order status page using the Additional scripts box.

Tracking orders

Conversion tracking codes, such as a tracking pixel, can be added to your store to track customers purchasing from your store. Tracking codes are typically used on the order status page.

Tracking scripts are provided by a third-party, and are used as a snippet of code in your Shopify admin.

Steps:

  1. After you have your tracking code, copy it to your clipboard with cmd + c on a Mac or ctrl + c on a PC.
  1. Under Order processing, go to the Additional scripts text box.

  2. Paste your tracking code from your clipboard with cmd + v on a Mac or ctrl + v on a PC.

    In that text box, you are able to use the shop Liquid object, the order Liquid object, and the OrderStatus JavaScript asset.

Conditional integration

Some providers require you to show their tracking pixels only if the customer came with a certain reference parameter (usually ref, source, or r).

Shopify stores these values with the orders and makes them available using landing_site_ref.

For example, your affiliate provider wants you to include their pixel in the checkout, but only for customers that come through their referrals. The URL that you register with your tracking system would look like this:

http://www.example.com/?ref=tracking-site

The ?ref=tracking-site must be something unique.

It's used on the last page of checkout to verify that a given order came by someone referred by your affiliate.

To set up conditional integration, go to your Checkout settings page and add the affiliate script:

{% if landing_site_ref == 'tracking-site' %}
<img src="https://www.trackingx.com/pixel.gif?amount={{ total_price | money_without_currency }}&amp;order-id={{ order_number }}&amp;currency={{ currency }}" height="1" width="1" />
{% endif %}

Because of the if landing_site_ref == 'tracking-site' statement, the pixel will only be displayed to customers with the correct landing_site_ref.

Examples

Basic conversion tracking

Suppose a third party asks you to integrate a tracking pixel like this:

<img src="https://www.tracking.com/u?amount=<AMOUNT>&amp;order-id=<ORDER_ID>&amp;currency=<CURRENCY>" height="1" width="20" />

Based on that code, you need the following Liquid tags:

  • The total price of the order: {{ total_price | money_without_currency }}
  • A unique order id. order_number prints out the name of the order such as #2322 without the hash character: {{ order_number }}
  • The order's currency. You can either hardcode this or use {{ currency }}

Replace the placeholders in the tracking code with actual Liquid tags:

<img src="https://www.tracking.com/pixel.gif?amount={{ total_price | money_without_currency }}&amp;order-id={{ order_number }}&amp;currency={{ currency }}" height="1" width="1" />

When customers reach the last page of the checkout, the code that's delivered to the browser looks like this:

<img src="https://www.tracking.com/pixel.gif?amount=55.34&amp;order-id=4343&amp;currency=USD" height="1" width="1" />

Conversion tracking that describes the order

<img src="https://www.emjcd.com/u?CID=YOURCID&amp;TYPE=YOURTYPE&amp;METHOD=IMG&amp;CURRENCY={{ currency }}&amp;OID={{ order_number }}{% for line_item in line_items %}&amp;ITEM{{ forloop.index }}={{ line_item.sku }}&amp;AMT{{ forloop.index }}={{ line_item.line_price | money_without_currency }}&amp;QTY{{ forloop.index }}={{ line_item.quantity }}{% endfor %}" height="1" width="20" />

Facebook Pixel

There are two different methods for adding Facebook Pixel tracking to your store. The two methods to add Facebook Pixel tracking do not work together. You need to choose one or the other:

Conversion tracking with order IDs

For best results, count conversions only when customers complete transactions with your store. If a customer revisits or reloads the conversion page, then their session might count as more than one conversion. You can use order ID conversion tags to minimize the counting of duplicate conversions. Order ID conversion tags track a customer's first visit to the conversion page only. Your customers' order IDs appear as {{ order_number }} in the Liquid tag.

For help adding order IDs to your conversion tags, visit Google support.

Ready to start selling with Shopify?

Try it free