Welcome to WebmasterWorld Guest from

Forum Moderators: DixonJones & mademetop

Message Too Old, No Replies

Session tracking headaches...

Difficult client proving to be a nightmare.



1:28 pm on Aug 20, 2001 (gmt 0)

10+ Year Member

Redesigning a site for a client, and have been told that I HAVE to include their current HTML-based tracker still. Trouble is, in the site's current frames format, it acts as a session counter. When taken out of frames however, it of course reverts to being a simple hit counter.

The client wants nothing other than HTML and JavaScript, no ASP or anything like that, and no frames any more either. So I'm struggling to decide how best to keep their tracker working as it has done in the past. I thought about doing something in JScript, but as it doesn't store permanent variable values across pages, I fail to see how I can get it working at all. The word "cookies" springs to mind - something with a document.write statement in it to add the tracker when the first page of the site is viewed that session - but I've no idea how to get this working, or indeed if this would work at all.

I don't want to lose this project - does anyone have something a little more "concrete"?!


9:04 am on Aug 21, 2001 (gmt 0)

10+ Year Member

Your idea sounds as if it should work.

If you slightly modify this script [javascript.internet.com] you should be able to only display the tracker code on the first visit.

Note that this code sets the cookie to expire after 1 day, so that repeat visits within 24 hours will not be tracked. I believe that if you omit the "expires" parameter the default is to delete the cookie at the end of the session (when all browser windows are closed). This may be a more appropriate setting.


10:53 am on Aug 21, 2001 (gmt 0)

10+ Year Member

That looks pretty much "on the money" thanks mark. I'll have a bash at mod'ing this script, and then adding a close.sibling statement to the main page, activated via a timeout.

Should keep everyone happy with any luck.


Featured Threads

Hot Threads This Week

Hot Threads This Month