Earlier quoted context omitted.
with static sites server-side analytics are doable. You can still cookie the browser, record it to access log and you can get pageviews and uniques easily
Problem is if you're using a CDN it might not give you access to complete logs. Still there's at least one better free option than GOOG analytics IMO[0] [0]: https://anderspitman.net/20/#get-off-google-analytics
It's a tradeoff, you get to decide if you run code on your visitor's computers without consent and get analytics that are wrong in one way, or if you run code on your server with your own permission, and get analytics that are wrong in another way and simpler.