Back to Guides

How to track website visitors by country

Tracking visitors by country means recording each page load with the country that IP address belongs to, then reading the totals over a real date range. You do not need a survey, and you should not expect the city to be as solid as the country.

Country is the geographic field worth trusting first. Databases that map IP ranges to places are reliable at country level for ordinary home and mobile connections. They get worse as you zoom in, and they follow the network, not the passport.

Set up the collection

You need something on the page that triggers a request your stats service can see.

  1. Create a widget and add the site. On MapMyVisitors that starts at create a widget. The snippet is an image or a small script. Paste it into the site template, a sidebar, or just before </body>.
  2. Load the page once in a private window, from a network that is not your office VPN if you want a clean test dot.
  3. Open the stats page for that site. Confirm the test visit landed in the country you expect.
  4. Leave the snippet on the template so every public page reports, not only the homepage. A map on one page only counts loads of that page.

The same visit record feeds the map and the country table. If the dot is in Germany and the table has no Germany, you are looking at different date ranges or a cached page that never requested the widget.

A practical install, including the image fallback for sites that strip JavaScript, is in add a visitor map widget. The mechanics of the dot itself are in what is a visitor map.

Read the country table

Pick a range long enough to drown out your own testing. A week is the minimum for a small site. A month is better. Then sort by visits and write down the top countries before you open any other report. First impressions from a map are sticky, and the table is the check.

For each country that matters, answer three questions:

  • Which pages did they open? A country piled onto one URL is a content or a link event. A country spread across the whole site is an audience.
  • What referred them? A referrer from a national newspaper, a local forum, or a .de site explains the row. An empty referrer does not; it can be a direct visit, a private browser, or an app that does not send a referrer.
  • Is the row new? Compare the same length of time immediately before. A country that doubled is a lead. A country that is always second is your baseline, not news.

MapMyVisitors shows country and city breakdowns, page URLs, and referrers on the stats page, with a date range so you can do that comparison without exporting first. Export still helps when you want a spreadsheet: the best practices notes cover cleaning country names before you pivot.

How much to trust the place

Signal Typical reliability Why it slips
Country High for consumer ISPs VPNs, hosting providers, and some mobile gateways
Region or city Moderate The database often has the ISP's city, not the visitor's
"Near me" or a street Do not use it IP data is not GPS

A visitor in Brazil on a US VPN is counted as the United States. A visitor on a phone can appear in a city they drove through last year, because the carrier's address block is registered there. Treat city lists as color. Treat country lists as the decision.

Bots add fake countries too. A datacenter range in a country you do not publish for, with hundreds of one-off hits and no referrer, is not a fan club. If a row looks impossible, check the user agent and whether the hits share a tiny set of pages.

What to do with a country that shows up

Geography is only useful if it changes a page, an offer, or a schedule.

  • Language. If a non-English country is consistently in the top five and the landing page is an article, translate that article, not the whole site. Link the translation from the original.
  • Examples and currency. A pricing page read mostly in the UK is easier to trust with GBP and a UK example. You learned that from the table, not from a hunch.
  • Time of day. Country plus timestamp tells you when to post or when to answer support. The country alone does not; pair it with the hour.
  • What not to do. Do not buy a country-specific ad campaign off one afternoon of dots. Do not block a country because of a bot spike until you have looked at the pages and the user agents.

If the business question is "which campaign in that country worked," country data is not enough. You need tags on the links you control. What is UTM tracking covers those tags. The country table tells you the audience arrived. The tag tells you which link they used.

A simple monthly check

Once a month, export or copy the top ten countries and the top ten pages. Note anything that moved by more than a third. That is the whole habit. The map on the public page can keep doing its job, which is showing that the visits are real and spread out, while the table does the analysis.