Session Tracking With Apache Page 4

Écrit par
Martin Brown
Martin Brown
Published: Jul 20, 2010
Updated: Nov 10, 2020
3 minute read
ServerWatch Le contenu et les recommandations de produits sont indépendants de la rédaction. Nous pouvons gagner de l'argent lorsque vous cliquez sur des liens vers nos partenaires. En savoir plus



Dynamic Solutions

If you are developing a dynamic site (i.e., using PHP, Perl, or Java), then the mod_usertrack module will not be very useful. This is because much of the site’s functionality may be embedded into the dynamic components. This can make the limited output mod_usertrack provides useless because the form elements and components are not stored in the logs.

Also, it’s highly likely that your dynamic solution may already be using some kind of user session tracking tool that can help provide the sought-after information. The fewer cookies supplied to a client, the less likely users will be over-conscious of the information stored, and will thus be more likely to use the site.

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

How information is logged and tracked is entirely up to you, but for the most part it depends on the type of site created and how the information is monitored. For simple monitoring, we recommend a very simple log that generates simple sentences like this (obviously with each session ID appended to each line):

User searched for books with 'Apache' in the title
User viewed the book 'Pro Apache' User added the book 'Pro Apache' 
   to their basket
User viewed basket

Although simplistic, it has the benefit of being very readable, while not permitting easy summary processing. For example, when using this method it is difficult to see how many people searched for books with ‘Apache’ without doing some more extensive text processing. When that level of detail is needed, write the information to a database in a rigid format, like so:

Tracking More Data

SessionIDOperationParameterID
98374SearchApache 
98374View 3475
98374Buy 3475
98374ViewBasket  

As the contents of this table illustrate, it would be possible to obtain the number of times a page for a particular book was viewed and the book was purchased, and how frequently various search terms were used. This is how, for example, Amazon.com is able to provide a user with ‘recommended’ titles.

The Performance Trade Off

Regardless of whether you use mod_usertrack or a system embedded into your dynamically driven site, there will be some performance trade offs. The trade off comes at a number of levels, but just the act of exchanging cookie data and looking up cookie information between browser requests is time consuming, not to mention the overhead of writing the information to a log file or database.

This will present an issue (if only a small one), however you look at it, and deciding whether to go ahead will rely entirely on how much value there is in the information and how much of a trade off you are willing to make between the value of that information and the effect on your site.

Advertisement

Generally, for dynamic sites, the extra information gained — especially if that information is used to help guide the user to other products or items he may be interested in — is significant. Most dynamic sites are already reading and writing to databases or files, so one more will not hurt.

Martin Brown

Martin Brown is a ServerWatch contributor.

ServerWatch Logo

ServerWatch is a top resource on servers. Explore the latest news, reviews and guides for server administrators now.

Propriété de TechnologyAdvice. © 2026 TechnologyAdvice. Tous droits réservés

Divulgation publicitaire : Certains des produits qui apparaissent sur ce site proviennent d'entreprises dont TechnologyAdvice reçoit une compensation. Cette compensation peut influencer la façon dont les produits apparaissent sur ce site, notamment l'ordre dans lequel ils apparaissent. TechnologyAdvice n'inclut pas toutes les entreprises ou tous les types de produits disponibles sur le marché.