How can I capture or detect users action?

SuchangKo
New Member
3 0 0

Hello, 

I want to capture and handle the user's actions to add gamification.

in example, 'add cart event' , 'buy (include purchase)'.. etc

I think ajax api in theme is good solution. but I need server-side solution. 

How can I capture user event on serverside? webhook? subscribe?

 

Replies 2 (2)
james-langille
Shopify Staff
65 14 18

Hello, @SuchangKo,

I think Webhooks (https://shopify.dev/api/admin-rest/2021-10/resources/webhook#top) would be a great place to start for your use case. We send webhooks on several topics to applications that subscribe to them that are installed on shops. In particular, I would look at the cart/* and checkout/* webhooks.

james-langille | Developer @ 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

SuchangKo
New Member
3 0 0

Thanks for your help!! @james-langille 

I tested webhook solution ( carts update/create ) according to your suggestion. 

It's good things for my main requirements. but I can't get user data.

in webhook-cart example response, it has not user data. also real response too.

searching this requirement, I found weak-security but available solution. use 'liquid' or 'theme-ajax' to get user data & cart item data. is it best for my requirement?

 

---

this post seems to be same my question. https://community.shopify.com/c/shopify-apis-and-sdks/understanding-adding-cart-attributes-to-webhoo...

is it same answer in 2021?