User location data not accurate

I’ve recently switched my domain over to using cloudflare, and I’ve noticed that the location data of my users isn’t as accurate as it used to be. I’m using posthog for tracking. I assume this has something to do with the way cloudflare handles the domain / CDNs.

Any ideas?

The IP addresses that your origin server sees will be from Cloudflare and as these are anycast, location information is not relevant. If you restore visitor IPs then things should go back as they were, see…

…or…

2 Likes

IP geolocation is not 100% accurate. Instead of using default Cloudflare geolocation, you can implement your own IP geolocation from 3rd party providers such as IP2Location in your web server.