You can use geo-targeting in order to display or hide ads for visitors coming from a specific location, i.e. country, city, or continent with the “Geo Location” Visitor Condition.
This feature is included in the Geo Targeting add-on.
Table of Contents
Download and connect the MaxMind databases automatically
The Geo Targeting add-on by Advanced Ads requires the GeoLite2 databases provided by MaxMind. Advanced Ads can connect with MaxMind and download the databases automatically for you. All you need is a free license key from MaxMind.
Follow these steps to install the Geo Targeting add-on, generate a license key at MaxMind, and let Advanced Ads download the databases.
- Download and install the Geo Targeting add-on
- Enable the license key at Advanced Ads > Settings > Licenses > Geo-Targeting
- Sign up as a GeoLite2 user for free at maxmind.com
- Generate a license key in your MaxMind account
- Select My License Key in the left navigation
- Click on Generate new license key
- Give your license key a title
- Select “No” when you are asked “Will this key be used for GeoIP Update?”
- Please note: the MaxMind license key will only be visible once, so please save it somewhere for later use. You can generate a new free license key in your MaxMind account anytime.
- Copy the generated license key to the field “MaxMind license key” in your Advanced Ads settings at Advanced Ad > Settings > General > Geo Targeting
- Click “Update geo location database (~66MB)” to upload the files and connect with the databases
- if you get the error message “Database update failed”, please check if the license key is correct or try again later if it is a temporary error by MaxMind
Advanced Ads will download the database files to the folder wp-content/uploads/advanced-ads-geo on your webhost. You can update the database after each first Tuesday of a month.
Manually upload the MaxMind databases
You can also download the MaxMind databases manually and upload them via FTP in the folder wp-content/uploads/advanced-ads-geo of your WordPress installation.
Follow these steps to manually upload the GeoLite2 databases:
- Sign up as a GeoLite2 user at maxmind.com and generate a license key as described above
- Download the databases GeoLite2 City and GeoLite2 Country in the binary format from your MaxMind account (they are provided as GZIP files. You don’t need to download the SHA256 files.)
- Unpack the GZIP files. Each archive contains a .mmdb file and two .txt files.
- Upload GeoLite2-City.mmdb and GeoLite2-Country.mmdb into the folder wp-content/uploads/advanced-ads-geo via FTP
- enter your MaxMind license key into the field “MaxMind license key” in your Advanced Ads settings at Advanced Ad > Settings > General > Geo Targeting and save the settings
Please make sure to upload both .mmdb files. Advanced Ads will recognize the databases automatically. When the databases are successfully connected, you will see the confirmation “Geo Database found” at Advanced Ads > Settings > General > Geo Targeting.
Using Geo Targeting
To geo-target an ad go to the Visitor Conditions meta box on the ad edit screen and select the geo location option.
After selecting this condition, you can choose whether the ad should show up or be hidden for the location. Then choose the country or continent. Inserting a city is optional.
Display Ads by Country
In order to display or hide an ad by country, you must select it from the second select field of the geo location options.
The plugin provides a list of all available countries. If you are missing one then please contact us.
You can find some very common countries at the top of the list and the rest later. You can also just start typing the name to jump to it.
Leave the field for the city and state empty in order to target all visitors from that country.
Display Ads by City
In order to target a specific city for an ad to be displayed or hidden, enter the name of the city into the City field.
You don’t need to select a country or state.
Display Ads by State/Region
The level of a state or region depends on the individual structure of the country you are targeting. In order to target a state, enter the name into the State/Region field.
You don’t need to select a country. Entering a city name would lead to the region being ignored in the check.
Display Ads by Continent
You find the selection of a continent in the second select field below the most common countries.
There is also a bulk option to select countries from the European Union, which is not identical to Europe as a continent.
Targeting multiple geo locations
You can also target multiple geo locations, e.g. two or more different countries.
Example: showing ad in Los Angeles and San Francisco:
To target multiple locations you just add another visitor condition with the OR connector. There is no limit on locations you can combine with each other.
Using translated state or city names
The geo location database provides some translations for city and state names. The availability of these translations is depending on the country.
In order to check names in other languages, choose one from Advanced Ads > Settings > General > Languages of names.
There are up to 8 languages available. If the name you entered is not available in the chosen language then it will be checked against the English name.
Targeting locations by radius
You can target a region or larger area around a specific spot using the radius option.
The usage is straightforward: choose whether to include or exclude the given area, the distance and whether it should be measured in kilometers or miles.
Then get the coordinates by entering a city name and click on the appropriate results to load the exact coordinates.
This option is also only as accurate as the underlying database and might still be off.
What else you need to know
Like with all dynamic ad conditions an installed and activated cache can influence the functionality in a negative way. Use cache-busting in Advanced Ads Pro in such cases.
If you are missing more details for your targeted region then please check out the Extending the database section.
The Radius option might not work when your traffic is using a different nameserver, like Sucuri or CloudFlare.