Web Analytics with JavaScript Page Tagging and Server Log Files : Comparison of 2 Analytical Methods

Introduction There are 2 primary ways to collect and analyze web server log files. The first way is through the use of JavaScript code embedded between the [head] metatags of each page you need to analyze. The JavaScript code is executed when the page loads. An example of this service is Google Analytics.

The second way to analyze web traffic data is with web server log file analysis software like Analog or AwStats. Most web servers record the data about each visit to a web page to a log file on the computer. These log files are then used by log file analysis software to create web usage activity reports.

Comparing JavaScript Page Tagging and Web Server Log File Analysis Software Both web server logs and JavaScript code are useful tools for collecting web usage and activity data. However each is limited in the type of data it generates, and both are dependent upon their environment (web server or browser settings).

Here are the major differences between JavaScript page tag and Web server log file analysis.

Execution Some visitors disable the ability for their browsers to execute JavaScript code so, if you rely on JavaScript code tagging, you will not have any web traffic data for their visits. On the other hand, some web hosting services will not give you access to your raw log files and if you do not have access to your raw log files you will not be able to analyze your log files. This is especially true for some blog hosting services.

Data Collection Some web traffic data like monitor settings and resolution can only be accessed through JavaScript page tagging software. Some types of web traffic data like file downloads from a website is recorded in the log files but not easily tracked by JavaScript page tagging methods.

Page Caching This affects the accuracy of web traffic reports. Using JavaScript the effect of page caching may be minimized because the JavaScript code executes each time the page is requested.

Page Size Adding JavaScript code to your web pages increases the size of the individual pages and eats into your bandwidth. On the other hand, web server log files do not eat into your bandwidth or add to your page size.

Installation JavaScript code has to be added to every page that is tracked. Web server log file does not need to be added to the pages being tracked. Generally your web server will record your web traffic to a log file without any special customization.

Reliability Web server file logging tends to be more reliable than JavaScript page tagging methods. With web server log files, the same server hosts your website and records the requests for your pages. With JavaScript page tagging, your browser has to send your web traffic data over the internet to another server. Sometimes, this will fail because of general network issues or because the remote server is unavailable.

Conclusion In this post I described and compared the 2 best practices used for web traffic data collection and analysis. Personally, I use both practices for collecting and analyzing web traffic data for my sites because each best practice has its strengths and weaknesses and neither is superior to the other.

Kingsley Tagbo is a web analyst and the author of Best Kept Secrets of Web Traffic Analysis