: Ideally you do not do with Google Analytics at all. For this use case GA has three shortcomings that work against you: it does not work in realtime it does not track individual users it
Ideally you do not do with Google Analytics at all.
For this use case GA has three shortcomings that work against you:
it does not work in realtime
it does not track individual users
it requires authentication to display data
To use GA for product recommendations on a per user basis you would need to send a unique id per user. Then you need a serverside proxy that queries the GA API for users with that id to see which products they have visited (you can't do it in JS because then you'd have to expose your credentials to everybody who looks at the source code). However it takes 4-24 hour before data is processed in GA, so this will work only if there is at least that much time between visits.
If "recommend the last visited product from a prior visit" is your exact requirement if would be a lot easier to write a side script that stores an id (read from/written to a first party cookie) along with a pagename/product name and displays it for returning visitors. This could be done serverside or clientside and would not need to involve GA at all.
More posts by @Alves908
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.