How to Place a Pixel on Shopify
You can use conversion tracking to track when your customers visit your checkout page and how often they make a purchase. Conversion tracking can help you learn more about purchasing trends for 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.
On this page
- Google Analytics conversion tracking
- Tracking pixels
- Facebook Pixel
- Conversion tracking with order IDs
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.
You can add tracking pixels to your order status page using the Additional scripts box.
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.
After you have your tracking code, copy it to your clipboard with cmd + c on a Mac or ctrl + c on a PC.
Under Order processing, go to the Additional scripts text box.
Paste your tracking code from your clipboard with cmd + v on a Mac or ctrl + v on a PC.
Customers might return to the order status page multiple times. This can skew your conversion analytics. You might want to run scripts on the first visit only.
Some providers require you to show their tracking pixels only if the customer comes 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:
The ?ref=tracking-site must be something unique.
It's used on the last page of checkout to verify that a given order came from someone referred by your affiliate.
To set up conditional integration, go to your Checkout settings page and add the affiliate script:
Because of the if landing_site_ref == 'tracking-site' statement, the pixel will only be displayed to customers with the correct landing_site_ref.
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>&order-id=<ORDER_ID>&currency=<CURRENCY>" height="1" width="20" />
Based on that code, you need the following Liquid tags:
The total price of the order:
A unique order ID. order_number prints out the name of the order such as #2322 without the hash character:
The order's currency. You can either hardcode this or use
Replace the placeholders in the tracking code with actual Liquid tags:
<img src="https://www.tracking.com/pixel.gif?amount=&order-id=&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&order-id=4343&currency=USD" height="1" width="1" />
Conversion Tracking that Describes the Order
<img src="https://www.emjcd.com/u?CID=YOURCID&TYPE=YOURTYPE&METHOD=IMG&CURRENCY=&OID=" height="1" width="20" />
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:
You can integrate your store and Facebook Pixel in your Shopify admin without using any code. You need your Facebook Pixel ID.
You can add the code manually to each page of your store and to your checkout.
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 in the Liquid tag.
For help adding order IDs to your conversion tags, visit Google support