While Google Analytics may be the most popular analytics service, there are times when you want to use your own hosted solution (intranet, control over data). Piwik is a great open source package that provides an impressive set of tools and a very nice look and feel. Using it with Elgg is extremely easy. You can write a plugin to do this in a few minutes as Elgg provides an analytics view in the footer that can be extended.
This is all it takes:
- Install Piwik
- Create your Elgg plugin skeleton
- Create a view to hold your Piwik javascript code - in this case piwik/analytics
- Register a callback for the init:system event
- In the callback extend the footer/analytics view
- Install and activate the plugin
The structure of this very simple plugin looks like this:

You can download it here.
Piwik and Elgg