Pixel Placement on Shopify

How to Place a Pixel on Shopify

 

Caution: This is an advanced tutorial and is not supported by Shopify. Knowledge of web design languages such as HTML, CSS, JavaScript, and Liquid is required. We suggest hiring a Shopify expert if you are not comfortable proceeding with the following tutorial.

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

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.

2.    From your Shopify admin, go to Settings > Checkout.

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.

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

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.

Conditional Integration

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:

Example Domain

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.

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:

  • 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=&amp;order-id=&amp;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=&amp;OID=" 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 in the Liquid tag.

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