It's cool that in also works with SPA frameworks. Thanks for sharing.
In other surveilance news, I've been adding Matomo[1] for web analytics to my site for the first time. Used to be called Piwik? It's free/selfhostable web analytics, which is more than enough for small projects and landing pages.
I've been pleasantly surprised with how it works so far, but I had to write some code to trigger it in the right part of my react-router initialization.
[1] https://permanent.cloud/apps/matomo
(and its cool I'm not helping Google spy on people who visit and help me out)