Wondering where your visitors come from?
WordPress doesn’t include visitor statistics itself, so there’s no way to know how many people are visiting or what countries they’re in.
The good news is that this is easy to add with the help of a free plugin.
Keep reading to find out how it works.
How to find the geolocation of visitors
To find where your visitors are coming from, you can install the free Independent Analytics plugin.
Independent Analytics records all of your site’s visits and can show you your top pages, traffic sources, and the geographic locations of your visitors.
It doesn’t require any configuration, so you can simply search for it by name in the Plugins > Add New menu to install it, and tracking will begin right away.
Where to find visitor geolocation data
With Independent Analytics installed, you can visit the new Analytics menu added to your sidebar and then click on the Geographic menu item.
This will take you to the Geographic report, which includes a world map showing the locations of every visitor:
Below the chart is a data table listing every city a visitor reached your site from. This table is sortable and filterable, so you can use the toolbar above to narrow down the results to just one city, subdivision, country, or continent.
If you’re selling products with WooCommerce, you’ll also appreciate that this enables you to track sales per country and city.
Please note that this data isn’t gathered retroactively. You’ll only begin collecting this information about your visitors once you install and activate Independent Analytics.
How the geolocation tracking works
If you’re a developer and want to take a crack at this yourself, or you’re simply curious, here’s how geolocation tracking in Independent Analytics work.
We don’t have an API for querying this data or grabbing the current visitor location. However, we hope this overview is helpful if you want to replicate this functionality.
When you install Independent Analytics, it downloads a copy of the DB-IP Lite database, which contains a specially formatted database that relates IP addresses to physical locations.
When someone arrives on your site, their IP is found in one of the headers, such as HTTP_CLIENT_IP. The MaxMind DB Reader PHP API is then used to look up their IP address in the DB-IP Lite database and find out where they visited from.
For privacy reasons, Independent Analytics doesn’t save the plain IP address. After using it to find the visitor’s location, the IP is hashed, and a non-identifiable signature is saved to recognize future visits from this visitor.
And if you’re not technically minded, I hope this hasn’t totally confused you 😆
Visitor geolocations uncovered
Now you know how to find out where your visitors are coming from and how the tech works behind the scenes.
If you haven’t gotten started yet, here’s a download link for Independent Analytics:
It installs like any other plugin and starts tracking immediately – no configuration required.
If you have any questions or feedback about detecting WordPress user locations, please drop a comment below.
Thanks for reading!