There is a ton of projects like this, all open source and free to selfhost: Plausible, Matomo, Offen, Posthog, Goatcounter, Umami. Or the built in analytics of the static site host like vercel/cloudflare
goaccess is also quite nice. It just reads the web server log for nginx or Apache and gives you a nice dashboard from that.
I can recommend Plausible.
One interesting option to look for is https://volument.com — which focuses on insights