Shopify reference parameter does not work

1 0 0

I am trying to make a referral management app and want to track from which referral the order is coming from. I have registered the order creation webhook. The data coming from the order has these following fields which may be useful but their response is either null or "" or something that is not useful to me.

        referring_site: '',
        landing_site: '/admin/auth/login',
        reference: null,
        user_id: null,
        source_identifier: null,
        source_url: null,
        landing_site_ref: null

I am expecting a reference here because I added /?ref= at the end of the URL when ordering a product. How should I proceed to achieve my objective? There is also a way in which whenever a customer visits using the referral link, we can add a cookie. And whenever he places an order we can track using this cookie? But how? There is nothing like a cookie field coming from webhook.

Replies 2 (2)

1245 113 149
  1. Referral Link Generation: When generating referral links, append a unique identifier or token to the URL, such as /product?ref=XXXXX. This unique identifier will help you associate the referral with a specific customer.

  2. Tracking Cookies: When a customer visits your website using a referral link, you can set a cookie in their browser to track the referral. This can be done using JavaScript. For example:


document.cookie = "referral_token=XXXXX; expires=Fri, 31 Dec 2023 23:59:59 UTC; path=/";


Shopify Partner
2 0 0

I also have the same problem. From my understanding from here we can pass any value in the product ref param (e.g. https://[shop-name][product-name]?ref=[unique-ID]) and it'll be forwarded to webhooks (I'm listening to orders/paid to be precise). However, what I get in landing_site_ref is always null.