Users Insights uses an IP-based geolocation for its Geolocation module. In this guide we are going to explain the IP-based geolocation works in more detail.
How the IP-based Geolocation works
Whenever you connect to the Internet you get a unique identifier for you or your network, called an IP address. Usually ISPs (Internet Service Providers) have a certain range of IPs that they work with, and they can delegate different addresses to the different users as they connect.
The way the IP-based geolocation works is simply by checking which IP range is used by which area, using an IP-to-location database. So, you can find the information like the country and the city that your users come from, just by knowing their IP address. The IP-based geolocation however can’t be 100% precise, as it relies on an address that is usually being shuffled through a few users of a certain area.
But this is also the reason why IP location is so useful. And although you won’t get your user’s house number, you can get a great deal of information about them without ever having to even ask for it. Once they connect to your site you already know their IP address, so just by using the Users Insights Geolocation module, you can find their location. Usually the country accuracy is around 99%. The city accuracy could be a bit less depending on the user’s country, but it’s still very high.
Strengths and weaknesses
IP-based geolocation is the most used technique for tracking the user locations for a reason. It works very well for what it’s been intended, and the other techniques have their own use cases.
For example, you could use the HTML5 geolocation API, which gives you a GPS-like location, with a great deal of precision. But unlike the IP-based geolocation this technique requires the user’s consent. So, they’ll be prompted to enable it, and unless your site really needs that, it’s very likely that users won’t be willing to share their location.
Hence, IP-based geolocation works very well for analytics-type analysis, as you can reliably collect a lot of data. It can also be used for user interface customization but it has its limitations due to its nature.
In addition, it’s worth pointing out that no geolocation technique is 100% precise. For IP-based geolocation users can have VPNs, Proxys and other IP obfuscation tools. The HTML5 geolocation is also susceptible to data injection (fake locations sent by the user), or no data being sent at all since it requires the user consent. So, if your application requires the exact address of the user to the precision of their house number or flat number, the most reliable way to obtain this data is just by asking the user for it.
Geolocation in WordPress and WooCommerce
Any website that has the IP address of an visitor or user can make a geolocation lookup (by using an IP location lookup service) to get approximate location of the user. WordPress by default only stores IP addresses of users that are leaving comments on your website. These IP addresses are stored in your database and are used in order to help site owners with unwanted comments or spam. WooCommerce also uses customers IP address for variety of reasons, like detecting customer location for shipping and taxes purposes, fraud detection etc.
All this IP detection and usage in WordPress and WooCommerce is used internally (behind the scene) meanings this geolocation data is not easily available to the WordPress admin. For this you need a seperate geolocation plugin, like Users Insights, that can give you general insights about where your users come, including an interactive map view and different location based filters. With this information you can analyze your user base, which can help you provide a better user experience for your customers and also make better informed decisions.