A tool you host yourself

Matomo

Source code: github.com/matomo-org/matomo

Reading the record: its licence, updates, setup and sources.