468,283 Members | 1,945 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,283 developers. It's quick & easy.

Tracking user activity in PHP

Hi,

My client is using the UBB Threads forum and I was recently asked to
look into adding the ability to track the activity of each of the users
to see who is more active than others. Users are identified by a
cookie.

Now can this be done at the server level somehow? Or would it be easier
to include a tracking function in each page that records a per user hit
count?

Obviously I don't want to give the server more work to do than is
necessary.

Thanks in advance,
Dave

Mar 8 '06 #1
1 4994
>My client is using the UBB Threads forum and I was recently asked to
look into adding the ability to track the activity of each of the users
to see who is more active than others. Users are identified by a
cookie.
Take the value from $_COOKIE['userid'] and use it to increment a
counter in a database for the user. Or log the user id, page,
timestamp and IP address in a database. It depends on how much
detail you need.
Now can this be done at the server level somehow?
Yes.
Or would it be easier
to include a tracking function in each page that records a per user hit
count?
The counting would have to be done on each page, or in common
code included from each page. I believe Apache has a capability
of specifying a header file for each PHP page in a directory so
you could use that without editing existing pages.

Client-side tracking is difficult because Javascript is Turned
Off(tm), a single user does not necessarily mean a single computer
with a single browser, and the data, being stored on the client,
isn't as accessible when you need it.
Obviously I don't want to give the server more work to do than is
necessary.


Gordon L. Burditt
Mar 8 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Kenneth Courville | last post: by
1 post views Thread by Bhavesh Patel | last post: by
5 posts views Thread by HttpWebRequest | last post: by
2 posts views Thread by Jesper | last post: by
4 posts views Thread by David Chang | last post: by
2 posts views Thread by C# programmer | last post: by
2 posts views Thread by jlaustill | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by zattat | last post: by
2 posts views Thread by MrBee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.