Skip to content
English
  • There are no suggestions because the search field is empty.

How to Setup Tracking in Shopify

LinkTrust utilizes Shopify's theme and Customer events to track using first party cookies. By default, Shopify blocks the third-party cookies generated by LinkTrust tracking links, which effectively breaks how LinkTrust tracks. However, by following the steps in this article, you can setup first-party cookie based tracking which will be much more reliable.

Part 1: Modifying the Theme

1. Navigate to the latest version of our theme code, which can be found here. Keep the tab open for later use.

2. Sign into Shopify and navigate to your store's theme code by clicking on Online Store > Themes > The ellipsis (next to Edit theme) > Edit Code:

3. After clicking on "Edit code" you should be navigated to the theme's code editor. Open layout -> theme.liquid:

4. Scroll down to the closing head tag (</head>). And paste the code from the link in step 1 just before the closing </head> tag:

Note: The code may look slightly different from the image provided. Make sure  you use the latest code from the link in step 1 above. 

5. Click Save in the top right corner.

Part 2: Setting up Consumer Event Pixel

The code added to the theme.liquid will save the click ID so we can use it for this next part. This code will be setup to fire every time an order is made. 

1. From the Shopify admin page, click on Settings in the bottom left:

2. Click on Customer events > Custom Pixel > Add custom pixel:

3. Give your new pixel a name then click "Add Pixel":

4. Upon adding the pixel, you should see a page where you can add the code. Update the Permission and Data sale settings as needed, but the defaults should work for most people. 

5. Add the code from here. You need to update the "HTTPS://DOMAIN.COM" from the code to match the tracking link domain for your LinkTrust account:

Note: you can update the useCampaignFallBack, but it is optional. Set it to true if you want organic traffic or traffic that does not have a click ID to be recorded. This will apply to all traffic without a Click ID.

6. Click Save:

Part 3: Campaign Setup

Now Shopify is ready to start tracking. However, the click ID does need to be provided to the landing page so it can be pulled into a cookie on the store. This can only be done by a user with access to the LinkTrust client portal.

1. Log into https://account.linktrust.com

2. Click on Campaigns > View All, or click here: https://account.linktrust.com/Campaigns/Search

3. Search for and click on the campaign you are running traffic for.

4. On the landing page, add a new or additional query string parameter: ?ClickID=[=ClickID=]

Example: https://mylandingpage.com?ClickID=[=ClickID=]

Don't forget to update any additional landing pages configured for the campaign!

5. Click Update in the lower right corner. 

You can now test by generating a tracking link and making a sale on the Shopify store. You can set the store to testing mode to avoid having to make real payments.