Table of Contents
Please be aware that IPs are constantly changing. The more populated the region, the more accurate and constant the geo-targeting is working.
Please note that the used GeoLite2 database by MaxMind might miss IPs especially for small locations and cities. See upgrade options below.
There is also a list of how accurate the lists are on a city level for each country, see GeoIP2 City Accuracy.
Database download problems
Please follow these steps if the database can’t be downloaded from the server automatically:
- get GeoLite2 City and GeoLite2 Country from the Maxmind DB column on this page
- unzip both files
- upload them into wp-content/uploads/advanced-ads-geo via FTP
You can set the constantADVANCED_ADS_GEO_TEST_IP in your wp-config.php to simulate a user with a specific IP or when using a local environment.
define( ‘ADVANCED_ADS_GEO_TEST_IP’, ‘22.214.171.124’ ); // some German IP address
Other resources for testing:
In order to find a potential problem with geo-targeting, you can log all checks made by the plugin.
Add the following line to your wp-config.php file in order to log all checks done by the Geo Targeting plugin.
define('ADVANCED_ADS_GEO_CHECK_DEBUG', true );
Once the constant is added, all checks will be written into the geo_check.log file in your wp-content folder. You can access it by using the following URL with example.com being your domain: http://www.example.com/wp-content/geo-check.log.
One log entry might look like this:
GEO CHECK (setting|visitor): COUNTRY |DE – REGION | – CITY new york|berlin
The value from the ad settings (left) and the one from the current user (right) are separated by a pipe (|). In the example above, the visitor is in Berlin, Germany (DE) but the ad setting is New York.
Note that COUNTRY and REGION will only be listed here if you provided a value in the geo-targeting Visitor Condition. When you set a continent, it will also be listed next to COUNTRY.
There is no error output if your IP is empty, e.g. when you are on a local environment.
Matching city and state names
Unfortunately, there is no list available with all regions. We suggest to enable geo-targeting debugging and get regions from the log file.
Keep in mind that city and state names must be perfect matches with the geolocation database. Even small differences will result in a broken check.
Example: Bryanskaya Oblast’ and Bryanskaya Oblast’ are not the same string, because of the different apostrophe.
Missing entries and extending the database
The GeoLite2 database created by MaxMind might not be as accurate, especially for smaller areas.
MaxMind offers the GeoIP2 database with better accuracy on a country or city level. See their offers.
In order to use their additional database, just rename it to GeoLite2-City.mmdb for the city level and GeoLite2-Country.mmdb for the country level and replace the file with the same name in wp-content/uploads/advanced-ads-geoin order to use it.