Using GeoIP with OpenX

We do not provide support for OpenX. For OpenX Geotargeting support, please see the OpenX Paid support and services page.

We also provide an installation guide for openAds.

Installation of GeoIP Country database with OpenX

Here is a brief outline of the steps needed to install GeoIP Country with OpenX on Unix or Linux. For more details, see page 42 of the OpenX administrator guide.

First, download the GeoIP database, and transfer the file to the server hosting OpenX. Once you have uploaded the GeoIP tarball to your server, open a ssh session and run the following commands:

$ tar xvfz GeoIP-106_*.tar.gz
$ mv GeoIP-106_*/GeoIP-106_*.dat /usr/local/share/GeoIP/GeoIP.dat

Then from OpenX set the GeoIP database location under geotargeting options to /usr/local/share/GeoIP/GeoIP.dat.

Installation of GeoIP Region database with OpenX

The instructions are similar to the ones above for GeoIP Country. The commands for GeoIP Region are:

$ tar xvfz GeoIPRegion-115_*.tar.gz
$ mv GeoIPRegion-115_*/GeoIPRegion-115.dat /usr/local/share/GeoIP/GeoIPRegion.dat

Then from OpenX set the GeoIP database path under geotargetting options to /usr/local/share/GeoIP/GeoIPRegion.dat.

Installation of GeoIP City database with OpenX

The commands for GeoIP City are:

$ tar xvfz GeoIP-133_*.tar.gz
$ mv GeoIP-133_*/GeoIPCity.dat /usr/local/share/GeoIP/GeoIPCity.dat

Then from OpenX set the GeoIP database path under geotargetting options to /usr/local/share/GeoIP/GeoIPCity.dat.

If you do not have shell access to the server

After you have downloaded the database, unzip it using a program like WinZip. Then rename the *.dat file to GeoIP.dat, GeoIPRegion.dat, or GeoIPCity.dat, for the GeoIP Country, Region or City databases, respectively. Finally upload the *.dat file to the /usr/local/share/GeoIP or other user-specified folder on your server using FTP or another upload mechanism.

Older versions of OpenX/phpAdsNew

There have been reports of phpAdsNew 2.0.6 not working with GeoIP. If you run into issues with 2.0.6, we suggest that you try upgrading to 2.0.7 or later.

Earlier versions of OpenX/phpAdsNew only support GeoIP Country and GeoIP Region. We have a patch for phpAdsNew 2.0 that works with the MaxMind GeoIP City database.


If you have set up the country targeting on a campaign, and configured OpenX to set the path to the GeoIP.dat file, but OpenX does not deliver any ads to the country specific ad, then you may need to modify the OpenX source code to send the $_SERVER['REMOTE_ADDR'] variable instead of the $HTTP_SERVER_VARS['REMOTE_ADDR'] variable in libraries/, which might have issues due to load balancers.

For OpenAds 2.0.11, to see the geotargeting menu, you have to select Country from the limitations menu which starts with “Weekday”.