We have a product based website. We show same products on the search page, details page, recommendations, e-mails, SMS and many other places to the users like any other e-commerce website.
On each of our product, we give "Add to cart" button. We want to check this button's usage from each of these places. For example, how many "Add to cart" clicks we got from search, details etc. pages.
There are multiple ways to do this:
- From client side i.e. android, ios, mobile, website: Start sending an origin id with each product's "Add to cart" button click i.e. 1 for search page, 2 for details etc.
- From the server side, guide the clients with URL for "Add to cart" and send URL as /api/addcart/?origin=1. This way all clients will automatically start sending w/o putting and maintaining this logic at every client.
Is 2nd the best approach to solve this problem or do we have any other better alternative? And If its the best way, how good is to track such things in URL query string of POST API? (As /api/addcart is POST endpoint)