• Skip to primary navigation
  • Skip to main content
  • Skip to footer

Merchant Labs

Helping online merchants succeed is what we do best!

  • About
  • Contact
  • My Account

Shopify / March 24, 2017

Shopify = track a reference end to end

Shopify has a built in URL parameter that when used in a very specific way can help you track a visitor who was referred by someone all the way to the Thank You page.

The trick is that the ref parameter only works on the very first page load of the shop. In other words, this will not work if you try to use the ref parameter via an html img or iframe tag after the page has loaded.

That being the case, this basically means that the URL a visitor uses to come to the shop MUST have the ?ref=SOMEREFCODE at the end. i.e.: https://myshopifystore.com/products/myproduct?ref=x7T2z

That being the case, on the order status page, you could do something like this:

{% if landing_site_ref != blank %}
<script>
{% if landing_site_ref == ‘x7T2z’ %}
alert(‘{{ landing_site_ref }}’); // this will display the SOMEREFCODE
{% else %}
// do nothing or maybe something else. its up to you
{% endif %}
</script>
{% endif %}

Filed Under: Shopify Tagged With: Coding

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Footer

Shopify Partner

Let Merchant Labs, with over 15 years experience in ecommerce, help you SUCCEED online! From …

Read More about Shopify Development Services

  • Twitter
  • YouTube

Ajax-Cart Coming Soon

What is Ajax-cart for Shopify? Ajax-cart for Shopify is a big project to bring some of the most wanted features to the Shopify cart page. This page is also known as the basket screen. Its …

more about Ajax-Cart for Shopify

Tags

Apps Script Coding Documentation Javascript MySQL PHP Shopify Liquid

Contact Us

Merchant Labs
Los Angeles, California

P: 424-236-0372
E: [email protected]

Proud Partners For

Copyright © 2025 · Digital Pro on Genesis Framework · WordPress · Log in