Script for "Recently Viewed Items"?



Hi All,

I’m hoping someone in here can help me find a script or perhaps a tutorial for a similar script. It has to do with adding a list of 5 to 10 of “your recently viewed pages/products” on a site. Something akin to Amazon’s recently viewed items added to a column somewhere on the site.

I’m not a script person but I’m not afraid to install, edit or learn something new so when asked about this, I thought I’d look around but have yet to find anything out there. Searches are only coming up with tracking scripts and though I want to track, I don’t want the end result to be a stats page…LOL.

Either of these would be acceptable - 10 Most Popular Pages (adjusted daily according to logs) or 10 Recently Viewed Pages (I assume according to visitor’s cookies).

Would this be best done by cookies, server logs, php, cgi or? None of which I have much experience in but wouldn’t mind giving it a go if it didn’t mean staying up all night wrestling with it. Or would this require a programmer and major fees? Any suggestions would be most appreciated.




My first reaction would be give each visitor a unique cookie. Have every page read the cookie and write the access to a mySQL database.

then have the “recently accessed” script do a simple query on the mySQL database. The logging would be a simple
includeonce "logme.php"
type call at the top of every page. (They would obviously have to be PHP pages).

-Jason - Home Page
MP3Mystic - Personal Streaming Music server.
(Neither of these sites are still hosted at dreamhost)


Thanks Jason. I guess I’d better learn about cookies!