I have requirement to show Recently viewed items by user and most viewed items on my website. Assumed I could use insight but looks like that is for a different purpose.
Could anyone help me how to go about implementing this and any samples would be helpful?
You can use the EPiserver Profile Store for this.
You certainly can use profile store for that purpose. It's basically built for user-centric data (which could include the user's recently viewed pages) but, assuming you're using the inbuilt page view tracking, the event data is available so you can use that data to get the info you need both at an individual level and agregated across all users. You'd be best off using the KQL querying for this otherwise there's a bit of an overhead in processing the data yourself. I've written more about it here:
Actually, thinking about it a little more, I think you'd be best using KQL querying of Profile store for the aggregated data from all users but, for the data on individuals' most recently viewed items, you'd be best either using the filter based querying of profile store or an approach similar to that described in Mark's post mentioned above. The reason KQL wouldn't be suitable for the individuals' most recently viewed pages is that there is a delay between data being stored in Profile Store and that data being made available for KQL querying which may lead to out-of-date pages being shown to the user.
Thanks for the inputs. I will take a look at those. However isn't profile store part of Insight or am missing something. I was under impression that insight was to be used for reporting and not for content presenting.
Episerver Profile Store is used for storing website visitor profile and behavior data collected by the tracking functionality in Episerver. The data in Profile Store can then be analyzed and used for personalization and omnichannel marketing actions.
Episerver Insight is the user interface for viewing and filtering visitor profiles, and creating segments to be used as input for omnichannel campaigns.
Profile Store + Insight is probably the way to go. But, if you don't want to go that route, here's a (slightly old) blog about using Google Analytics to show popular/trending content: https://devblog.gosso.se/2018/07/most-popular-using-google-analytics-api/