Geo Targeting is the addon for WordPress plugin SAM Pro (Free Edition). Using this addon you can restrict showing of your ads basing on global location of the visitor. To determine the location of the visitor you can use popular online services of geo locations or your own data tables.


  • Three-level geo targeting (country, region, city)
  • Data connection with MaxMind (MaxMind GeoIP Legacy or MaxMind GeoIP2 Precision) and DB-IP online services
  • Data connection with MaxMind GeoIP2 DB or GeoLite2 DB located on your server
  • Tool for creating necessary data
  • Easy-to-use interface
  • High level of integration with the parent plugin

System Requirements

  • PHP 5.3+
  • WordPress 4.1+
  • SAM Pro (Free Edition)


To install this addon you must have a working version of WordPress already installed. Also you must have installed SAM Pro (Free Edition) version 1.5 or later. This addon will work properly only with Free edition of SAM Pro.


  1. Unzip the downloaded file in the suitable folder. After that unpack archive file.
  2. Log into your hosting space via an FTP software.
  3. Upload the extracted plugin folder (spf-geo-targeting) into wp-content/plugins folder on hosting. Correct path after upload will be wp-content/plugins/spf-geo-targeting
  4. Activate the installed plugin.

By WordPress

  1. Navigate to Plugins > Add New
  2. Click Upload Plugin button
  3. Select file on your computer and click “Install Now
  4. Activate the installed plugin

After activating the plugin, visit the SAM Pro plugin settings page and verify that addon appeared in the list of active addons.


Addon adds its own options on the SAM Pro plugin settings page. Thus, to configure settings for the addon, go to the SAM Pro plugin settings page.

General Tab

Rules Section


Allow to use rule of Geo Targeting – turn on this rule for using geo targeting.



This feature simplifies the process of updating Geo Targeting addon. By using this feature there is no more necessity to download install packages and upload them via wp-admin or FTP protocol manually. This way, automatic updates save your time and prevent you from doing boring routine. Thanks to them you are quickly informed about a new version and with just only one click will be your plugin up to date. All important information can be found in Updates section of WordPress Dashboard.

From version you can update the plugin directly from your WordPress blog using Oauth authentication.

OAuth is an authentication protocol that allows users to approve application to act on their behalf without sharing their password. More information can be found at or in the excellent Beginner’s Guide to OAuth from Hueniverse.

To enable the plugin update from your blog, you should generate a Personal Token on the site of the Envato API. Paste the generated Personal Token in the “Your Envato Market Personal Token” field and turn on checkbox “Allow upgrading of the plugin using WordPress tools”.

The required permissions for your Personal Token should be:


Tools Tab

Statistics Settings Section

Geolocation Resources

Select your geolocation resource – Select geo location resource you want to use.

  • DB-IPDB-IP online service. API Key needed.
  • MaxMind GeoIP Legacy – GeoIP Legacy Web Services. API Key needed.
  • MaxMind GeoIP2 PrecisionGeoIP2 Precision Services. User ID and License Key needed.
  • Your own MaxMind GeoIP2 DB or GeoLite2 DB – Your own DB tables. You must prepare these tables for use. Use conversion utility from MaxMind. The start/end IP addresses should be represented as integers.
  • Your own MaxMind GeoIP2 or GeoLite2 MMDB file – You own MMDB database file. Unpack and upload it onto your server. You can use plugin uploader on the Tools Page…
In order to be able to use geo targeting you must:

  1. Select Resource of Geolocation and enter the necessary data for it
  2. Turn on the rule “Geo Targeting” on General Tab
  3. If you want to use the two-level or three-level geo targeting, you should create DB Table of Regions (see Tools)


Addon adds it own tool on the Tools page of the SAM Pro plugin.


Create the DB table of regions and fill it with data.
If you want to use geo targeting you must create table of regions and fill it with data. Just click button “Fill Data“. If the table is not exists it will be created automatically.

Optionally you can recreate the table before filling data and clear the target table before filling data.

Geo. MMDB File

You can upload your MMDB file onto the server using this tool. Because this file is large (approx 52MB), you should sure that next parameters of PHP on your server let you to upload large files. These parameters are:

  • max_execution_time  – The maximum time that a script can run. Typically, it is sets to 30-60 seconds. Set 500 sec.
  • max_input_time – The maximum time that data can be received on the server. It also is setted to about 30-60 seconds. Set 500 sec.
  • upload_max_filesize – The maximum file size that is allowed to be uploaded to the server. This is key tuning, however, contrary to a common misconception, is not the only one necessary for downloading large files in PHP. Set 100M.
  • post_max_size – The maximum size of the data being sent. Set 100M.

Why these parameters are important:

  • max_execution_time – Here you need to put the time for which the file should be loaded in time. Obviously, the 50MB file size is unlikely to load in 30-60 seconds, so of course, this time should be increased.
  • max_input_time – Similarly with max_execution_time . After all, if the at first 60 seconds will be received data, and then stop, then the file will not have time to upload.
  • upload_max_filesize – This option usually is changed by all and without problems, however, when nothing changes, they are surprised, and even though it is a key one, nevertheless, the other three are also very important.
  • post_max_size – The maximum size of the sent data is also obvious, because if a file is large, then it can not completely be uploaded because of this limitation.

Also you can upload this file via FTP. Upload it into plugin folder data: /wp-content/plugins/spf-geo-targeting/data.

Ad Editor

Targeting Tab



Show this ad only for visitors from these countries/regions/cities.

Enable geo targeting for the edited ad.


Fill by the codes of countries (ISO 3166-1), comma separated or Select from world map.



Fill by the codes of regions of selected countries (ISO 3166-1 + ISO 3166-2), comma separated or Select the regions from the list. Selection is available only if you created Regions DB Table (see Tools above).


The table contains regions only from already selected countries.

Multiple cross-page selections are available. In other words, choose as many regions as you want on any number of data grid pages, then click “Select”.


Fill by names of cities, comma separated. Use international names of cities (Latin symbols).

You can leave empty any of “geo location” fields.

For example: “Countries” and “Regions” fields are empty. “Cities” field set to “Brest” value.

Result: This ad will shown for visitors from any Brest city (France, Belarus, Germany, Chech, etc.).

Purchase Geo Targeting addon just for $10

© 2016 – 2017, minimus. All rights reserved.