A tool you host yourself

PostHog

Source code: github.com/PostHog/posthog

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