1. Installation

1.  Download and UnZip the latest version of the geotarget plugin from your members area.

2.  Unzip the zip folder that looks something like geotarget_v1_xxx.

3.  Upload the interior geotarget folder to your wp-content/plugins folder

geotarget install

4.  Go to your plugin section and activate the Geo Target plugin.

activate plugin

5.  Please make your db and download folders writeable inside the geotarget plugin folder.  You will asked to do so if they are not already.

2.  Updating IP Database

You might want to first update your IP database to the current version.  To do so please go to your Settings->GeoTarget Settings in your WordPress admin area.

At the top you will see the option to update database now.  Please click on the Update Now button.  You can also set the amount of days for every update.  The database itself is updated every Tuesday, so once every 7 days would be enough.

The Geo Target plugin uses the free database from Maxmind here: http://dev.maxmind.com/geoip/geoip2/geolite2/

update database

3. Creating Custom Region (Group Countries, States or Cities)

You can create a custom group of multiple countries, states, and cities to filter by in the Geo Target setting area. Go to settings and click GeoTarget Settings.

Look for the Create a Region section. Enter a name for this region and then select at least one city, state, or country.

Create a name for your group and add countries, states, or cities to the group. For example, if you want to geo target European countries, select all the European countries and create a new group. You then can filter by that group.

Make sure you click Add to add the location to the group.  Then click save when you have all your locations added.

This feature is useful if you want to use this same group throughout your site. So you can just use the region code instead of selecting all of the same countries each time.

4. Use Geo Targeting Inside Posts or Pages

Geo targeting content from posts of pages is easy using built-in shortcodes.

Use The Geo Target Shortcode Button

Geo Target Shortcode Button

Geo Target Shortcode Button

Click the Globe icon to reveal the configuration settings for the Shortcode

Geo Target shortcode configuration

Geo Target shortcode configuration

So you can filter content by Country, State, City,  or a custom region group.  You can also exclude content the same way.

Here is the manual way to enter the shortcode inside a posts or page:

[geoip2 country=’US’ state=’US::Alabama’ city=’US::Texas::Austin’ region=”Region 1″] Filtered Content Here [/geoip2]

1.  Where ‘US’ is [[country code]]
2.  ‘US::Alabama’ is [[country code]]::[[state name]]
3.  ‘US::Texas::Austin is [[country code]]::[[state name]]::[[city name]]
4.  ‘Region 1’ is [[region name]]

Show country name, state name or city name of user for geo targeting

Here are the 6 shortcodes for showing IP user information:

Use the shortcodes below to display a visitor’s location based on their IP

  • [geoip2data type=’country’] -> Displays country name
  • [geoip2data type=’country_code’] -> Displays 2 letter country code
  • [geoip2data type=’state’] -> Displays state name
  • [geoip2data type=’state_code’] -> Displays 2 letter state code
  • [geoip2data type=’city’] -> Displays city name

5. Filter Widgets using Geo Targeting Plugin

You can easily filter any widget including custom widget using the GeoTarget plugin. So perhaps you want to only show a widget to a specific country or region this is how you can do that.

1. Add your widget to the sidebar and open up the options.

2. You will see the heading GeoTarget Widget. Under the title be sure to click the checkbox to Apply Geo Targeting for this widget.

3. Next you need to either pick a custom region you created or select a country, state, or city.  Save the settings and that is all.

4.  To filter mulitple locations, please create a custom region first.

5.  You can also exclude a widget from a certain location as well.

Geo Target Widget Settings

Geo Target Widget Settings

6. PHP Geo Target Code

Here are the functions needed to geo target other code using php.

Geo Target a Country:

<?php if (function_exists('geoip2_target') && geoip2_target(array('US'))==true)  { ?>

Content here....

<?php } ?>

Geo Target a State:

<?php if (function_exists('geoip2_target') && geoip2_target(array(''),array('US::Texas'))==true) { ?>

Content here....

<?php } ?>

Geo Target City:

<?php if (function_exists('geoip2_target') && geoip2_target(array(''),array(''),array('US::Houston'))==true) { ?>

Content here....

<?php } ?>

Geo Target Region:

<?php if (function_exists('geoip2_target') && geoip2_target(array(''),array(''),array(''),array('ustexas'))==true) { ?>

Content here....

<?php } ?>

7. Add Centralized Geo Target Shortcodes

With version 1.3 of the Geo Target plugin, you can now create your geo target shortcodes in a central place, so you can easily update site-wide shortcodes and CTAs throughout your site.

For example, let’s say you have a button, featured table, or common content that you Geo Target on several pages. Instead of updated that piece of content on a page by page basis, you can now update it once and all the pages will update.

Here is how to use this feature:

1. The first step is to locate the Geo Shortcodes post type in your WordPress admin area.


2.  Next, add your content you wish to target. You can include other shortcodes and formatted text as usual.

3.  Next, locate the GeoFilter Section on the right and choose Country/State/Region to include or exclude from this content.


4.  Save your post and then go back to your Geo Shortcode listing and you will see a shortcode to copy. It will be in the format of [geosnippet id=xx]

5.  Copy that shortcode and place it in any post or page that you want to display and geo target that piece of content. You can do this mulitple times to have several shortcode on one post or page.


If you ever need to target a different state or country, you can always edit the original shortcode once and it will update the content on all the pages/posts you have it displayed on.

8. Page Redirects

Also new in version 1.3 is the ability to geo target pages and posts and send users matching the geo target rules to a different page.

For example, let’s say you have a page that contains all US content and you would like a visitor from Germany to be directed to the German focused content. You can set a rule that when the visitor from Germany visits that page the will be automatically redirected to another page of your choosing.

You will see this new feature on pages and post on the right side called Geo Target Redirect.


Basically you can choose up to 3 instances of where to send a visitor based on their IP. Just enter the URL to send them to and configure your Geo Target option.