Session Tracking With Apache

By Martin Brown (Send Email)
Posted May 11, 2005


Using HTTP logs to track the users who visit your site isn't always as useful as you think it's going to be. While metrics, like the total number of page hits and, within that, page hits over time or from a specific IP address, easily identify, they don't always tell how people are viewing your site or answer specific questions the marketing department may pose.

Using HTTP logs to track the users who visit your site isn't all it could be. We look at mod_usertrack, an Apache module that uses cookies to identify a user's visit and records access to the site, as well as discuss solutions for dynamic sites.

This article looks at how to track progress through a site using an Apache module and provides answers to some of the more complex marketing-led questions that may be posed.

Tracking Progress

Sometimes when monitoring site usage you want to ask more detailed questions than "how many users" or "how many hits." You may, for example, want to determine if users are visiting your new product pages because they saw an advertisement on the home page or because they've been sent a link directly to it. Also, with most companies using firewalls, Network Address Translation (NAT), and proxy servers, identifying individual users can be impossible. Actually "following" a user as he works through the site is difficult.

Table of Contents
Tracking Progress
Adding mod_usertrack to Your Apache Installation
Enabling Tracking
Choosing an Expiry Time
Configuring the Log
Analyzing the Results
Dynamic Solutions
The Performance Trade Off

If you look at a typical log, it's easy to determine general information, such as page hits, but it's difficult to determine what an individual user might have been doing. Although you can configure the logs to include an IP address, this is neither as unique nor as easy to use as it sounds. Many users access the Internet through a NAT or proxy solution, which means hundreds, even thousands of users are hidden behind a single IP address.

Even if you can identify a single user as using a single IP address, tracking what she does — beyond simply viewing different pages — is more difficult, especially if the site uses a combination of static and dynamic elements or is entirely dynamic.

One solution to this is mod_usertrack, which uses cookies to identify a user's visit and then records access to the site identified by this unique ID. When the user first visits the site, she is sent a cookie with a unique ID, which is kept (until a predetermined timeout is reached) so you can track an individual's usage on your site. It's not a complete solution, but it enables the identification of individual users, even if they appear to come from the same IP address.

Like other modules, mod_usertrack is configured through a series of directives. The first step however, is confirming mod_usertrack is in your Apache installation.

>> Adding mod_usertrack, Enabling Tracking

Page 1 of 4


Comment and Contribute

Your name/nickname

Your email

(Maximum characters: 1200). You have characters left.