Forum software solutions have a way of indicating whether threads (and in the case of Daniweb forums to) have had their content viewed by a user.

How exactly is this done? Is reference to every page a user has explored stored somewhere, for every user (or for every page)? That seems like a huge amount of data potentially..

A solution I figured out was to write the modified date of a target file to a query string variable when rendering hyperlinks to that file; in most browsers, this makes links show as visited when a user has seen the target file but only if the target file hasn't been modified since the last time they saw it.

This is by no means ideal because a user might come on from a different computer or browser; and could think that they haven't followed any links...

I'm all for implementing detailed tracking per-authenticated user; but that means only authenticated users get the benefit of knowing when things are 'new'. Still; I suppose I could create a new guest account for every IP address.

Is there something I'm missing? I can see myself blowing my storage allowance on per-page user tracking O_o

Recommended Answers

All 2 Replies

The problem with your solution is that all users see the same file properties. But some users have followed the link, while others have not.

There are two ways to mark links as "visited"

- The browser can keep track of visits. This is the normal way of doing it. The browser has a list of visited links, and an adjustable time limit on the period of life for each link.

- This is what cookies are for. The website keeps a cookie on each user's browser. This can be as simple as noting the last time the user logged out, or as complicated as keeping a set of links to visited links.

The problem with both of these is that they don't work across different computers. In both cases, the information is saved on the user's computer. A database for this on a server with a large client base would be prohibitively huge.

One other possibility for keeping the user straight on multiple computers is to use a briefcase system, and put the browser's history and cookie files in the user's briefcase.

Ah, I should have been more specific there; it's not just important if a link has been visited; but also if data in and X virtual 'directories' below a current directory has been modified since a user last saw it.

I suppose cookies could work. I didn't really consider using them; I rate a site setting a new cookie more than a few times in a session as a large irrtatant (only because my browser's usually in a testing mode and asks me about every cookie a page tries to set).

I suppose (because my virtual directories are physical) that it would be quite alot simpler with cookies, good use of path/domain would mean much less need for classification at my end.. But indeed; it's not transferent between computers/browsers, and would generate a potentially huge amount of cookie data for my users...

My site uses a logging method already; at present every user has a file-vector into the folder representing their current location... I suppose it'd be simple (and fast per-request) to make those vectors leave persistant impressions. Limiting the persistance of information to the top X sublocations from a location would be ok aswell..

It seems quite a big planning task for something that on-the-face-of it seems simple.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.