I have one query on Google Analytics. I have to track the product which is only viewed by customer and then he/she simply leaves the website. When the customer re-visits the site, I have to show that product as an suggestion on website. How to achieve this using Google Analytics?

The site is built in Hybris.


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy