How can I capture or detect users action?

SuchangKo
Visitor
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 (Retired)
70 15 27

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.

To learn more visit the Shopify Help Center or the Community Blog.

SuchangKo
Visitor
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?