DEV Community

Discussion on: How to show recently viewed items in REST API?

 
bhumanyukumar profile image
Bhumanyu Kumar

If i managed to get the ip address, still i won't be able to track the recently visited products/items. Cuz the data related to product is served in the first request when the list of products is fetched on the frontend(A SPA using angular). Then the same information is shown on product detail page(No new request is made on the product detail page). So how can i track that how many times a product is viewed. Also one more point i want to mention here that i am not in favor of making entries in database for each product with its view counts. Cuz it will be very inefficient as database writes per request could lead to database I/O bottleneck. Since there is no session managed, its more complicated to track user activity in session.