Tuesday, May 3, 2011

How to enable openx for geotargeting

install openx  after that download free geoip city database from maximind site and uncompress it.

#wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
#gunzip -d GeoLiteCity.dat.gz

enable geotargeting in configuration section of openx administration account

copy GeoLiteCity.data to <openx_home>/plugins/geoTargeting/oxMaxMindGeoIP/data
sudo chown www-data:www-data GeoLiteCity.dat
sudo chmod 777 GeoLiteCity.dat

change geoTargeting plugin setting, add "GeoLiteCity.dat" for city data file

in <openx_home>/plugins/etc/oxMaxMindGeoIP/oxMaxMindGeoIP.xml change line as shown below for GeoLiteCity.dat

            <file path="{MODULEPATH}geoTargeting/oxMaxMindGeoIP/">oxMaxMindGeoIP.class.php</file>
            <file path="{MODULEPATH}geoTargeting/oxMaxMindGeoIP/">oxMaxMindGeoIP.delivery.php</file>
            <file path="{MODULEPATH}geoTargeting/oxMaxMindGeoIP/data/">GeoLiteCity.dat</file>

in <openx_home>/plugins/geoTargeting/oxMaxMindGeoIP/oxMaxMindGeoIP.delivery.php change following line
        //$geo = oxMaxMind_getGeo($ip, dirname(__FILE__) . '/data/FreeGeoIPCountry.dat');
        $geo = oxMaxMind_getGeo($ip, dirname(__FILE__) . '/data/GeoLiteCity.dat');

5 comments:

  1. Thanks for posting this! This is the only documentation I've been able to find on using a different geoip database. Not sure why openX doesn't just search the data directory for available databases instead of requiring you to edit an XML file and then not publishing how and where to edit to include the new geoip plugin database file.

    ReplyDelete
  2. Is there a way to know how to upgrade the database ? I try all the way and even you tutorial not anable city

    ReplyDelete
  3. to geotargeting, just change old file with new file. I think city targeting is only work for city listed in openx code.

    ReplyDelete
  4. I am unable to locate the following lines in /plugins/etc/oxMaxMindGeoIP/oxMaxMindGeoIP.xml
    //$geo = oxMaxMind_getGeo($ip, dirname(__FILE__) .'/data/FreeGeoIPCountry.dat');

    where do I add those lines?
    I am using XAMPP-1.7.9 on Win XP SP3.

    Is it necessary to add and enable php_geoip.dll in php.ini?
    I could only find the same for php-5.2.1 only, is there a way to compile my own .dll targeted towards php-5.3.x?

    Thanks

    ReplyDelete
    Replies
    1. in file "plugins/etc/oxMaxMindGeoIP/oxMaxMindGeoIP.xml"

      find following line in file section,
      oxMaxMindGeoIP.class.php
      oxMaxMindGeoIP.delivery.php
      GeoLiteCity.dat

      replace geoip database file "GeoLiteCity.dat" in 3rd line with your file name, if line is not there then add it

      Delete