benvinegar / counterscale

Scalable web analytics you run yourself on Cloudflare
https://counterscale.dev
MIT License
1.34k stars 61 forks source link

Adding Region and City level data #85

Open nickarnold opened 3 months ago

nickarnold commented 3 months ago

It would be nice to have the region (or regionCode) and city level data tracked by this script to give users a bit more granularity in the data that Counterscale makes available about visitors. According to the documentation these fields should be available to us in the incoming request object. It looks like it'd be pretty easy to simply add these fields to the schema, modify the collect script and then have this new information ready to surface in a forthcoming UI-focused PR to expose it to the UI.

@benvinegar Any thoughts on this? Opposition? I realize there's a fine balance between filling up the limited 'blobs' that CF makes available and having a useful and minimally-invasive tracker. It seems like region and city isn't too specific to malign with the lightweight and privacy-respecting goals here.

I'd rather make the change here for everyone rather than maintain a fork. Also, thanks for this! It's been very useful for a small handful of my projects.

benvinegar commented 3 months ago

Hey thanks for filing this issue!

I intentionally omitted going more granular than Country for privacy purposes. Other commercial privacy-focused web analytics products like Plausible and Fathom do the same.

I'm up for keeping this issue open for further discussion though.

nickarnold commented 3 months ago

I didn't see your response until this morning. Yesterday I went ahead and added the feature (UI and backend), so I've put up the PR for you or others to consider or use. A screenshot of the UI additions is available on the PR.

The CCPA calls out the sharing of the location data and specifically precise geolocation data. The GDPR calls out location and IP, but it seems to me that tracking something as broad as a city or a region/state doesn't really violate anyone's personal privacy. Personally I don't see an issue, but this isn't my project. 😄

Thanks again for making Counterscale! Cheers.

benvinegar commented 3 months ago

First off: even if I don't hit merge, really appreciate you taking the time to make a PR.

The GDPR calls out location and IP, but it seems to me that tracking something as broad as a city or a region/state doesn't really violate anyone's personal privacy

It is 100% a subjective product/brand-driven decision and not a legal one. Maybe I'd be open to state/province/region in the future. Will keep this ticket open.

(FWIW, I think it's okay to just keep a fork going and tweak it the way you like.)

nickarnold commented 3 months ago

Sure thing. I needed this feature for some of my own uses, so I was happy to share it with the community. Open source FTW!