There's a reason we don't do that anymore and it's that there's too much noise and it's easier to filter it out if you aggregate the data somewhere (bot traffic, scraping etc.). Sometimes you also don't really have access to HTTP server lots depending on where you deploy your frontend.
I used to do that almost 20 years ago with a little script.
This time I looked into my log file, said nope, too complicated, and just installed a WordPress plugin (or Matomo in another case).
I don't think that would play well with cdn caching.