User

Top Countries (Geographic Data)

How country detection works and how to enable it via MaxMind GeoLite2.

Last updated 1775692800

The Top Countries table shows where your visitors are geographically. Each row has a flag emoji, the country name, a bar chart, and the visit count.

This is one of the most rewarding parts of having analytics — seeing your site reach visitors in countries you didn't expect.

How it works

For every parsed access log line, the agent does an IP-to-country lookup using a local database file. The lookup takes about 1 microsecond per IP — fast enough to handle high-traffic sites without slowing down log processing.

The database is MaxMind GeoLite2-Country, a free IP-to-country mapping that's updated weekly by MaxMind. The file lives at /var/lib/opterius/GeoLite2-Country.mmdb on each panel server.

The lookup is fully offline — no API calls, no rate limits, no privacy concerns. The visitor's IP is checked against the local database and discarded immediately. The IP is never stored anywhere.

Enabling country detection

By default, GeoLite2 is not installed. Until the panel administrator installs it, the Countries table will be empty (or show "Unknown" entries).

To enable it:

  1. Sign up for a free MaxMind account at maxmind.com/en/geolite2/signup
  2. Once logged in, go to Account → Manage License Keys and click Generate new license key
  3. Note your Account ID and the new License Key
  4. In Opterius Panel, log in as admin and navigate to System Settings → Integrations
  5. Scroll to the MaxMind GeoLite2 section
  6. Enter your Account ID and License Key, click Save changes
  7. Click Download GeoLite2 to fetch the database to all panel servers

The download takes about 30 seconds (the file is ~6 MB compressed, ~10 MB uncompressed). Once it completes, the Countries table will start showing data for new visits.

Updating the database

MaxMind publishes a new GeoLite2 database every Tuesday. To get the latest IP ranges, click Download GeoLite2 again from the admin Integrations page. There's no harm in re-running the download — it overwrites the existing file in place.

A future release will add a scheduled task to refresh the database automatically every Wednesday.

Why country only and not city?

MaxMind offers two GeoLite2 databases: GeoLite2-Country (small, fast, free) and GeoLite2-City (larger, includes city/coordinates, also free). Opterius uses Country because:

  • The dashboard only displays country information
  • City data is much less reliable than country data, especially for ISP IPs
  • City lookups would significantly increase the database size (60+ MB vs 6 MB)
  • Storing city data in bucket files would bloat them
  • Privacy: country-level granularity is much harder to use for tracking individuals

If you need city-level data for a specific use case, you can manually replace the GeoLite2-Country.mmdb file with GeoLite2-City.mmdb on the server — the agent will use whatever's there. The dashboard won't display the city info though.

Unknown / ?? entries

If a visitor's IP isn't in the GeoLite2 database (very rare — happens for some new IP ranges or private network IPs), the agent records the country as ??. This shows up as a 🌐 emoji and "Unknown" label in the dashboard.

A small ?? entry is normal. If ?? is the largest entry by far, it usually means the GeoLite2 database isn't installed yet — go check System Settings → Integrations.

Privacy compliance

Country lookups are done locally with no external API calls. Visitor IPs are processed in memory and immediately discarded. The aggregated bucket files contain only country codes and visit counts — no IP addresses, no personal data.

This makes country tracking compatible with GDPR's "anonymous statistics" exemption. You don't need a cookie banner or privacy policy update to use it.