Piwik is an open source (GPL licensed), self-hosted, real time web analytics platform that you can download and install on your own web server. You can access detailed reports on your website visitors: the search engines and keywords they used, the language they speak, your popular pages, and a whole lot more.
All of Piwik's features are provided through plugins and an extensive API. To customize your system, you can either add new plugins or build your own to do what you want it to do.
Flexibility, control, and free.