counterscale icon indicating copy to clipboard operation
counterscale copied to clipboard

Adding Region and City level data

Open nickarnold opened this issue 1 year ago • 5 comments

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.

nickarnold avatar Jul 22 '24 17:07 nickarnold

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.

benvinegar avatar Jul 23 '24 02:07 benvinegar

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.

nickarnold avatar Jul 23 '24 14:07 nickarnold

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.)

benvinegar avatar Jul 27 '24 16:07 benvinegar

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!

nickarnold avatar Jul 27 '24 23:07 nickarnold

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.

Goatcounter does offer a configurable option to track regional data. But it seems only countries like USA and China can benefit from that. (I used GC before, but for my country, the data was not very useful so I disabled it)

lrh11099 avatar Jan 05 '25 10:01 lrh11099

Going to close this for a few reasons:

  1. I agree with Ben, if Plausible and Fathom don't track this, I don't think Counterscale should either.
  2. We just shipped UTM so we have event less storage available in Analytics Engine. I want to keep blobs available for future features like custom events.

If in the future Cloudflare adds more available blobs in AE, and there is more community need for this, someone is welcome to re-open this!

stordahl avatar Sep 23 '25 00:09 stordahl