'City data in Application Insights

I have multiple applications making use of Application Insights for Production Data. I'm trying to use the City telemetry field to map our current users. This data appears to be tracked very inconsistently and in most cases (> 75%) is just unavailable.

I understand some customers will be using VPNs which could affect the results, but not to the extent I'm seeing.

Here is the info from the Azure FAQ:

How are City, Country and other geo location data calculated? We look up the IP address (IPv4 or IPv6) of the web client using GeoLite2.

  • Browser telemetry: We collect the sender's IP address.

  • Server telemetry: The Application Insights module collects the client IP address. It is not collected if X-Forwarded-For is set.

You can configure the ClientIpHeaderTelemetryInitializer to take the IP address from a different header. In some systems, for example, it is moved by a proxy, load balancer, or CDN to X-Originating-IP.

Does anyone know how to improve geolocating user cities for App Insights?



Solution 1:[1]

IP Geolocation is not 100% accurate and you need to live with it. City accuracy is quite low because the information is guessed from multiple data that change frequently. One way to improve accuracy is to use a service that aggregates data from multiple sources and does it continuously, multiple times a day.

A second manner to enhance the results is to filter based on whether the IP is associated with a proxy by using threat data.

For both purposes, I recommend looking at Ipregistry, a service I work for:

https://api.ipregistry.co/?key=tryout

Solution 2:[2]

It would be great if MSFT could provide an example of manually setting the location in Browser telemetry. I understand privacy concerns, but our use-case is for internal enterprise apps used by our field service teams. Since Browsers can access the Geolocation APIs, it's probably straightforward to add that info. It's just a matter of knowing the right way to do it so it's picked up consistently.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Carlo Quinonez