How to track the referral of the order?

abhinavp00719
Shopify Partner
28 2 12

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.

Founder Descrii Description Generator
0 Likes
SBD_
Shopify Staff
Shopify Staff
1094 147 204

Hey @abhinavp00719,

 

landing_site_ref is ideal for this. If a customer enters your store at your-store.myshopify.com?ref=hello, landing_site_ref will be set to hello. This isn't restricted to the homepage either, for example your-store.myshopify.com/products/test?ref=hello will also work.

 

Keep in mind this is set when a customer first enters your store. So if they have been to your store previously (without a ref parameter), landing_site_ref will be null. This could explain your webhook results. Try placing a test order in a new incognito window (so landing_site_ref is reset).

abhinavp00719
Shopify Partner
28 2 12

Thanks for your response.

Can you please tell me more about these following fields from order:-

  • referring_site: '',
  • landing_site: '/admin/auth/login',
  • reference: null,
  • user_id: null,
  • source_identifier: null,
  • source_url: null,
  • landing_site_ref: null,
Founder Descrii Description Generator
0 Likes
SBD_
Shopify Staff
Shopify Staff
1094 147 204

landing_site - where the customer first arrived (e.g. "/products/avocado?ref=hello")

landing_site_ref - just the ref value (e.g. "hello")

referring_sitethe url of the referrer that brought the customer to your store

source_identifier - used if the order is placed via POS

user_id - the ID of the user logged into POS

source_name - where the order originated (e.g. "web" or "pos")

 

MHodge
New Member
1 0 0

I have tried this and am unable to get the required parameter, here is the flow I am using

  1. Load the site https://example.com/?ref=ThisWillBeUnique
  2. Customer adds product and buys
  3. Webhook received does not contain and reference to "ThisWillBeUnique" in any of the mentioned variables
  4. landing_site_ref is ALWAYS null, I have tried running through incognito and multiple browsers

On a side note I have also tried all permutations of the url

  1. https://example.com/products/?ref=ThisWillBeUnique
  2. https://example.com/products/product_name?ref=ThisWillBeUnique
  3. https://example.com/collections/all?ref=ThisWillBeUnique

Based on https://help.shopify.com/en/manual/orders/notifications/email-variables the landing_site_ref makes sense, but in all my testing it never produces a value inside the webook

I am running a development store with a webhook posting to a requestbin and I can see the result of the order.created webhook, I can simply never get landing_site_ref to have a value

Your help would be greatly appreciated

 

0 Likes
Debora_
Tourist
3 0 1

Hello there,

I have pretty much the same need, any update about the issue?

Thanks a lot!

 

Joris41
New Member
1 0 0

Any updates? I would like to use this as well.

0 Likes