How to manage geo-data
The Sales by Geo-data report shows your sales on a map. This page explains where the report takes its location data from and how to fill it in.
How the map works
The report groups sales by Country, State, Place or Postcode.
- Grouped by country, the map fills each country with a color that reflects its sales.
- Grouped by state, place or postcode, the map shows a point for each row at the coordinates of that location.
Use the buttons below the map to zoom to a continent, a region, or a single country.
A row with no known state or place, or with no coordinates, is still listed in the report table, but it has no point on the map.
Where the location data comes from
Orders carry only a country and a postal code. The extension looks up the state, the place and the coordinates of each postal code and stores them, using two cron jobs:
mst_advanced_reports_postcode_unknownruns once a day, at midnight. It collects the postal codes from order addresses that are not stored yet.mst_advanced_reports_postcode_updateruns every hour. It looks up the location of each new postal code with the public postal code serviceapi.zippopotam.us.
Make sure Magento cron is running and that your server can reach api.zippopotam.us. Postal codes that the service does not know stay without a location.
To run both jobs right away instead of waiting for cron, use the command:
php -f bin/magento mirasvit:advanced-reports:postcode:cron
Import postal codes in bulk
Mirasvit publishes ready-made postal code files that already carry locations. To import them at once, run:
php -f bin/magento mirasvit:advanced-reports:geo-import
The command downloads every published file and imports its postal codes, printing each file's name as it goes. Postal codes that are already stored are replaced with the imported data, and the hourly lookup skips the imported ones. Your server needs internet access to download the files.
See Command line interface for all commands of the extension.