How to track the referral of the order?

Shopify Partner
24 2 6

Hello! folks,

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=<randomStr> 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.