With the Geolocation addon for WP Popups, you can add geotargeting rules to your popups that let you only display a popup to users in specific:
- Countries
- States
- Cities
- Zipcodes
WP Popups lets you use both include and exclude rules. For example:
- You can only display a popup to users in Germany (include).
- You can display a popup to users worldwide except for users in Germany (exclude).
Keep reading to learn how to set up geotargeting rules in WP Popups.
How to configure WP Popups Geolocation Addon
There is no much to do… once you install the addon it will automatically download and install the free Maxmind database in your site. The only thing you need to check is that your live IP it’s being detected and geolocation data it’s correct. You can check that in WP Popups -> Settings -> Addons.
Once you choose your IP, which you can compare with the one you get in https://geotargetingwp.com/ip, you can save the addon settings and check that debug data it’s showing your location.
How to Add Geotargeting Rules in WP Popups
Related: Learn how to install a WP Popups addon.
To get started, either create a new popup that you want to add geotargeting to or edit one of your existing popups.
Then, go to the Display Rules tab.
WP Popups’ geotargeting options function just like any other display rule. Once you install and activate the Geolocation addon plugin, you’ll get four new rules in the display rules drop-down, divided into a Geolocation section:
First, select the type of area that you want to target from the four options:
- City
- Country code
- State
- Zip
Next, use the drop-down to the right to select between:
- is equal to – only display your popup to visitors in this area(s).
- not equal to – display your popup to all visitors except for those in this area(s).
Then, enter the geographic area you want to target with your rule.
For example, to only display the popup to visitors in Germany, you’d configure it like this:
For example, if you want to display your popups to all German and Belgium visitors except for people living in the city of Berlin, you could configure your display rules like this:
Or, you could combine a geolocation rule with a non-geolocation rule to target only visitors from Germany who are also browsing from a smartphone:
How Does WP Popups Determine a Visitor’s Location?
To match a visitor’s IP address to their physical location, WP Popups uses the free MaxMind GeoIP database. To avoid querying an external service for every visit, WP Popups downloads the database to your site’s server and automatically updates it every month.
Available shortcodes
There are some shortcodes in case you want to display geo information about the current user viewing the popup. Those shortcodes that you can add on any place inside the popup content are:
- {{country_name}}
- {{country_code}}
- {{state}}
- {{state_code}}
- {{city}}
- {{zip}}