The Geotargeting extension allows you to display popups based on the site visitor’s location. You will be able to target popups to specific countries, regions, and postal codes. If you haven’t already, refer to the extension installation documentation to install and activate your extension.
Setup #
in your WordPress admin area, head over to Popup Maker > Settings > Extensions > Geo Targeting.
Geo Targeting Provider #
At the time of writing we support the following providers:
- ipstack
- WP Engine’s GeoTarget Add-on
- CloudFlare IP Geolocation
Setting Up Using ipstack #
ipstack is a geolocating service for IP Addresses that updates their data up to 20 times per day. Even better, they have a free plan! However, the free plan does not use SSL, so you may want to upgrade to the paid plan after testing.
To get started:
- Go to ipstack’s pricing page
- Select sign up on the tier that works best for your site
- Once signed up, copy your API Key
Now, go back to the Geo Targeting settings. Paste your API Key into the IP Stack API Key field.
If you are using a premium IP Stack plan, check the IP Stack Pro Account option. This tells Popup Maker to use the https
version of ipstack’s API.
Once you are finished, be sure to click Save.
https
), you’ll need an ipstack paid plan if you want to avoid any insecure script errors. Insecure script errors happen when an SSL site tries to load a non-SSL ( http
) script. Setting Up Using WP Engine #
If your site is hosted on WP Engine and you have the GeoTarget add-on, a new “WP Engine” option will appear in the “Geo Targeting Provider” drop-down. Select that option and then click the “Save” button. You are ready to go!
* Please note: WP Engine only contains the country and region targeting conditions. The postal code targeting condition will not appear when using the WP Engine targeting provider.
Setting Up Using CloudFlare #
If your site is using CloudFlare and you enable their IP Geolocation feature, a new “CloudFlare” option will appear in the “Geo Targeting Provider” drop-down. Select that option and then click the “Save” button. You are ready to go!
* Please note: CloudFlare only contains the country targeting conditions. The postal code and region code targeting conditions will not appear when using the CloudFlare targeting provider.
Using Geotargeting Conditions #
Once your settings are set up, you can now use new conditions when editing your popups. To use one, first, edit the popup. Now, go to the “Targeting” tab of the “Popup Settings”. If you add or edit a condition, you will find two new conditions:
- Country Code Is
- Region Code Is
- Postal Code Is
Targeting Countries #
To target your popops to certain countries (or to exclude certain countries), you will use the “Country Code Is” condition. Within the country code condition, you can enter the country codes for each country you want to target. We use the 2-letter country code system, which you can find a full list of on this Wikipedia page. If targeting more than one country, you can use commas to separate them, as shown in the image below.
If you want to target all countries but exclude a few countries, you can click the “!” symbol to switch to the opposite mode for the condition. That means, show the popup to all countries except those listed.
Be sure to save your popup once finished.
Targeting States Or Provinces #
To target your popops to certain states or provinces (or to exclude certain states or provinces), you will use the “Region Code Is” condition. Within the region code condition, you can enter the region codes for each state or province you want to target. If targeting more than one, you can use commas to separate them, as shown in the image below.
If you want to target all region codes but exclude a few of them, you can click the “!” symbol to switch to the opposite mode for the condition. That means, show the popup to all visitors except those in region codes listed.
Be sure to save your popup once finished.
Targeting Postal Codes #
To target your popops to certain postal codes (or to exclude certain postal codes), you will use the “Postal Code Is” condition. Within the postal code condition, you can enter the postal codes for each postal code you want to target.
This condition can also accept a range of zip codes. For example, 32606-32608 would target 32606, 32607, and 32608.
Since many zip codes can be small and houses can be right on the border making it difficult for geolocation to get the right zip code, it is advisable to target a group of zip codes unless you specifically need to only show to an exact zip code. For example, if you were targeting zip codes of Brooklyn, New York, you might do 11201-11256 to cover Brooklyn but also include 11101 and 11379 which are just past it.
If targeting more than one postal code (or range of postal codes), you can use commas to separate them, as shown in the image below.
If you want to target all postal codes but exclude a few of them, you can click the “!” symbol to switch to the opposite mode for the condition. That means, show the popup to all visitors except those in postal codes listed.
Be sure to save your popup once finished.