Question

I want to implement a simple in-house table that tracks user page views on my website. Without targeting some specific hypothesis, what is useful data to store? Eventually I'll use it to build graphs or decision trees to better learn about our user base. This is static (no javascript).

Things I can think of:

  • URL accessed
  • HTTP refer[r]er
  • HTTP Accept Language
  • Browser-agent
  • Session id
  • User id (if logged in)
  • Time visited
Was it helpful?

Solution

It depends on how public your site is. If your site requires authentication you can have more controlled statistics because you can trace the user (visitors) history. In the case the user does not require authentication you are limited to the information provided by the SERVER VARIABLES: HTTP_USER_AGENT; REMOTE_USER; REMOTE_ADDR; REMOTE_HOST; REMOTE_PORT; HTTP_COOKIE; HTTP_USER_AGENT.

I have implemented something like this for some non-public site each time the user logs on to the site, the information I'm storing looks like:

  • User Key
  • Remote host IP
  • Date Logon
  • Last Request Datetime
  • Total time connected (minutes)
  • Last Request Minutes
  • Event/Action performed

OTHER TIPS

Sounds like a good start,

I'd be inclined to store visitor IP address, and derived from that via a geo ip lookup the location of the visitor.

Also you could consider reverse dns'ing the IP to get an idea of the isp you're user is on, you might never use it but then again it could be useful if you have a report of downstream caching causing problems.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top