[Pugged] Hit tracking, initial record.

ciapug@ciapug.org ciapug@ciapug.org
Sat, 14 Dec 2002 21:40:52 -0000


Chris Hettinger <cjh@raccoon.com> said:

> I have a small function which is to store some visitor tracking
> information to my site. I am storing a session_id, user_id (applicable
> only they are logged in), url, timestamp, and the ip of the request.
> 
> In my header file, Line 1 is a include of functions.php, below that
> (line 2) I make a function call to a tracking function. The function
> simply sets the timestamp, determines the request ip, then writes the
> data into a mysql table.
> 
> The issue however is the Session ID. On the very first instance of
> viewing my site, the record is written but there is no Session ID. If I
> refresh the page or continue my visit and browsing to another page, thus
> another call to the tracking function each record after has the session
> id.
> 
> Not sure I have provided the full scenario here, questions... Ask away.
> 

The only way I can think of to populate the session ID would be to
have a dummy page that just started the session, then have that page
redirect to the real home page, where it would write a valid session ID.

As far as if you need to be doing this sort of tracking - unless you
specifically need to do user based tracking, your apache logs and a
decent logging program will track that stuff just as well.

-dc