How to track your website's usage

There are various useless for a means to precisely track the usage of one’s website. The reasons range from curiosity, needing to understand what interests the visitor most or which category of visitors are the most important. The solution to this challenge should simply describe how this can be accomplished.
2 answers

Use Piwik to track website usage

Piwik is a free and open source web-analystics software. Different to Google Analytics (which could be seen as a privacy threat and has a monopoly position in web analytics), Piwik can be downloaded and run on your own LAMP server. Installation is a matter of minutes.

Similar to most approaches to web analytics, Piwik uses a JavaScript snippet you embed in your HTML-files for tracking. For further information on the use of this snipped, you might check out Interestingly, Piwik also provides an alternative approach using a specialized tracking API.

Last but not least, a quite interesting demo site of Piwik can be found at


Google-Analytics to track website usage

With google-analytics one can track ones website's vistors in various complex ways. The google-analytics tracking service is intuitive and free (up to 5 million hits per month). This solution will show how to implement the necessary functionality in ones website.

Step 1: go to the google-analytics website.

Step 2: register and login.

Step 3: place the provided javascript snipplet directly before the end of your webpage's body segment.

Here the snipplet (from 11/2010). The XXXXXXXX-X will be replaced by ones account number.
javascript start

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);

javascript end

That's it! But keep in mind that Google uses the information to extend its information about the visitor as well (privacy!).