Improve your statistic reports

Even if you started to use Log(psycho)Analyst and are very satistfied by the amazing amount of different reports proposed, you may want to have even better reports. This page proposes some tips to modify your web site, so that your log files are improved, and our log file analyzer can generate more evolved reports.

Select the appropriate log format

Your web server can usually output several kind of log formats. You should select the most complete format so that our log file analyzer can extract more information.

If possible, you should use the following log format (break on two lines for readability):

%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"
%S %D "%{Accept-Language}i" "%{X-Forwarded-For}i" "%{Via}i" "%{LPAUSER_ID}c %{LPASESSION_ID}c"

If not, you should use, on Apache web servers, the combined log format (not the simpler common log format).

Please refer to your web server documentation for more information on how to change your log file format.

Add a tracker on some pages

Informations such as the browser language, the screen resolution, and the installed plugin can be detected by some javascript code. The idea is to add a javascript tracker on specific pages of your web site. The tracker makes a request to your web server, thus send all the collected information to the server.

What information are extracted?

Log(psycho)Analyst javascript tracker can extract the following information:

  • Screen resolution;
  • Browser resolution;
  • Installed plugins:
    • Acrobat Reader;
    • Java;
    • Javascript;
    • Java Web Start;
    • Macromedia's Flash player;
    • Macromedia's Director plugin;
    • Quicktime Video;
    • Real Media Player;
    • Scalable Vector Graphics (SVG);
    • Windows Media Player;

Privacy: only these informations are collected. Javascript has security features that prevent access to local files on the visitor side.

Where to put the tracker?

The information retrieved by the tracker are usually valid during the whole visit. Thus, it is not necessary to add a javascript tracker code to each page of your site. Moreover, the tracker's code take some time to be downloaded and executed. It also takes some time to send the information back to your web server.

If you care about the page loading time, you should so add the tracker code only on specific pages. The ideal would be to have only one page per visit. Log(psycho)Analyst is smart enough to tell you on which pages you should put the tracker: have a look at the "Advice" page in the server statistics.

What javascript code should I insert?

You can insert the following code just before the end of the web pages suggested by the Log(psycho)Analyst advisor (see above):

<script language=javascript type="text/javascript" src="/lpa/logpsychoanalyst_tracker.js"> </script> <noscript> <a href=/lpa/iamabot.html> <img src="/lpa/logpsychoanalyst_tracker.js?javascript=no" height=1 width=1 border=0></a> </noscript>

This script generates a small transparent 1x1 pixel image on your web page, so that your visitors will not see it. If the browser's javascript feature is disabled (or not supported), the tracker send the information that javascript is not supported back to your web server.

Another feature of the tracker is to detect some unfriendly robots who spoof common browser HTTP user agent string. Robots usually follow the /lpa/iamabot.html link in the <noscript> section, thus your log files will contain this information. Humans do not usually follow this link, first because it exists only for browser without javascript capability, and because the link is almost invisible. This file is called a "robot trap".

You will need to add two files on your web server:

  • iamabot.html : must be copied to your /lpa/ directory (must be created if needed);
  • logpsychoanalyst_tracker.js : must be copied to your /lpa/ directory (must be created if needed);
  • english.png : must be copied to your /lpa/ directory (must be created if needed);
  • german.png : must be copied to your /lpa/ directory (must be created if needed);
  • french.png : must be copied to your /lpa/ directory (must be created if needed).


  • if needed, the image height and width can be set to zero (both in the above javascript code and in the logpsychoanalyst_tracker.js file. However, on some browsers, the tracker will not be able to send the information back to your web server, so that the visit will be less detailed.
  • you can change the location and name of the robot trap file.
  • you can change the location and name of the javascript tracker file.

Outgoing links tracking

When a visitor click on an external web site link (outside yours, possibly ending its visit to your site), your web server log files do not reflect this change. Knowing the next web site where the visitor goes after your is useful, because it gives you information on what is missing on your web site.

You can update all links to external web sites on your site as follow:

<a href="http://www.an_external_web_site.com/">A external web site</a>


<a href="http://www.an_external_web_site.com/"
onclick="return exit_link(this.href, this.name);">A external web site</a>>

On each page that have been modified, you need to add the following javascript code in the <head> section:

<script language="JavaScript"> type="text/javascript" <!-- function exit_link(url, name) { if(document.images){ imgX.src="/lpa/exit_link.js?url="+url+"&name="+name; } return true; } // --> </script>

At the bottom of the page, you also must to add the following HTML code:

<img id='imgX' src="" width="1" height="1" border="0" alt="" />

You also need to copy the exit_link.js file to your /lpa/ web directory. Note: this file is intentionally left blank.

Track printed pages

When a visitor is highly interested by one of your web page, he will probably print it for future usage or distributing to friends. You can track printed pages by adding the following code in the <head> section of each page to be tracked:

<link rel="stylesheet" href="look_and_feel_print.css" media="print" type="text/css" />

The look_and_feel_print.css style sheet file contains your usual CSS styles for printing. In this file, you must add a property that is used in every page (e.g. in the <h1> tag):

background-image: url("/lpa/logpsychoanalyst_print_tracker.png");

The logpsychoanalyst_print_tracker.png file must be copied to your /lpa/ web directory.

Track unfriendly robots

Your /robots.txt file can tell friendly robots that access to specific pages are disallowed. A bad practice is to use this technique to hide secret information (e.g. passwords) from public access: the list of disallowed files is a good source of information for hacker's robots. By adding the following lines to your /robots.txt file, you make a trap for such robots:

User-agent: * Disallow: /lpa/robotstxt_disallow_tracker.png

The robotstxt_disallow_tracker.png file must be copied to your /lpa/ web directory.

© 2004-2006 Log(psycho)Analyst, all rights reserved.