Discussing APIs and development related to customers, discounts, and order management.
As per the CustomerJourneySummary GraphQL documentation, you can pass a `ref` query param into the shopify store URL on load, which should subsequently populate the `customerJourneySummary.firstVisit.referralCode` and `customerJourneySummary.lastVisit.referralCode` fields after a customer checks out. Our Shopify app had been successfully using this method for the past year to track referral codes in orders placed for brands we work with. I check the values using:
query Orders {
orders(query:"some query", first: 25) {
edges {
node {
createdAt
customerJourneySummary {
ready
lastVisit {
referralCode
occurredAt
}
firstVisit {
referralCode
occurredAt
}
}
tags
}
}
}
}
I recently noticed a sharp decline in the success of this field populating. Now, frequently when I pass the `ref` param into the page that loads the session, the `referralCode` no longer populates in the `CustomerJourneySummary` field of the Order object. I see several samples that indicate it potentially is happening when the user logs in and checks out using Shop Pay during checkout (e.g redirecting to https://shop.app/pay/transactions/new/token/... during checkout), but it does appear to be happening across normal checkout sessions as well.
I was able to reproduce this in a controlled environment with these steps:
1. Visit https://mystore.myshopify.com/products/product?ref=myrefcode
2. Place an order for the product I just visited using the normal Shopify checkout
3. Use the Admin API to check the above GraphQL query, and verify that firstVisit and lastVisit are both null (after customerJourneySummary indicates as ready).
Has anyone experienced this? Is there potentially a regression? If someone on the Shopify side can help investigate, I'm more than happy to share order GIDs from orders where I know the ref tag was set but the referralCode in customerJourneySummary did not set. We see this issue across multiple brands we work with, so I don't believe it's brand specific.
Hi Fuzzy,
This does sound unusual - I've reached out to our internal dev team to take a closer look into why this might be happening.
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
firstVisit
array when we queried the order. Do the visit fields ever filter in after some time on your side, or do they always stay null?Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Hi Liam,
I am experiencing the exact same issue on my side.
After purchasing using Shopify url with unique ref param and after waiting 5 min before requesting the order response, I am receiving empty values in firstVisit and lastVisit fields.
I can share shopify store details in order to test it properly
Thanks