Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
I'm trying to build a logic that will allow to track if the Shopify Order was purchased via abandoned checkout URL and I'm wondering if it is even possible to identify the sign or flag or any value in the Order entity that is responsible for tracking this.
https://shopify.dev/api/admin-rest/2022-01/resources/webhook#top
According to the article above I can setup Shopify webhook "checkouts/update" that allow to receive a checkout recovery link:
abandoned_checkout_url: "https://checkout.local/548380009/checkouts/123123123/recover?key=example-secret-token"
Then the Idea is to provide this recovery link to the end User. Once user clicked the link and purchased the order I then can receive another webhook "orders/paid".
And the question is there any kind of parameter or sign in the orders webhook event that can allow me to identify that that particular order was paid via recovery link?
Do you keep state of which checkouts you've sent a recovery link for? If so, you can compare the checkout tokens on the completed orders to those of checkouts you've sent a link for.
Thank you for your post, @RalfatGadget
I think I got what you mean.
I think what you mean is:
1) I can store Checkout.Token in a persistent storage
2) When recovery link is sent to the user and order is purchased, I can determine if Webhook event's Order.Checkout_token is equal to previously stored Checkout.Token
3) If they are equal I can assume that order was purchased by recovery link that I sent.
But isn't Checkout.Token remain the same for Shopify checkouts?
For example:
1) User didn't complete checkout and left Shopify
2) I sent recovery link to that user
3) User didn't see my message and didn't follow recovery link
4) After some time user by his own returned back to the Shopify and completed checkout.
I think result will be the same, his Checkout.Token that I stored in the persistent storage will be the same as Webhook event's Order.Checkout_token. What do you think?
My goal is to to identify some kind of flag or parameter on Webhook Order event that will unambiguously indicate that Order was purchased via recovery link. Do you think it is possible?
That's a good point, I think you're right. But it would work the other way as well, you can't be sure that someone that converted using an abandoned cart email would not have converted shortly after anyway. Attribution can be hard in many cases.
Shopify does capture UTM params from recovery emails, see this screenshot of a test order I made by converting from a recovery email. But I'm not sure if they're exposed through any API. Not ever gone deep down a similar usecase.
I'd creep the API docs a little to scout for options, or check some app to see if similar functionality exists and figure out how they do it. When it comes to code, there's always a way 🙂
Thank you, @RalfatGadget
I've made a research of API docs and forums and so far I didn't find any mention of the parameter in the Order or Checkout entities that will unambiguously identify if the Order was purchased by recovery link or not.