I would like to show the user a list of items that they have recently viewed.
I would like to do this for users that have logged in and those who haven’t.
What is the best way of identifying a user that has not logged in?
I was thinking of just creating a cookie and having a collection called “cookies” with each document in the collection having an array called “recent documents”. Maybe I can periodically delete any documents which has an old cookie.
Is there a better way though? Is there a way I can use localStorage on the client’s browser but which doesn’t get lost if close the tab or even if they refresh the page?