I use Matomo, it runs on my home server, its open-source. Pretty sure you could run it on a Pi. There's a docker container that you can spin up in a few minutes.
Seconded - set up on a project instance last weekend in about 5 minutes, and it has been chugging along swimmingly since! And they’ve been doing it for a long time, Piwik was great even before the rebrand.
https://matomo.org/