Preview Openx geotargeting for different countries

Openx is a great open source ad server. If you have more than one website or simply want a flexible system for targeting your ads to the right audience, it’s well worth a look. One of many great features is the built-in Geotargeting plugin.

Of course, after adding local ads to your database, you want to have a look at what the page looks like for a visitor from a different country. It took me some time to figure out a way. But I found a good method for getting a preview for a different country. In openx version 2.6 you can edit the file /plugins/geotargeting/GeoIP/GeoIP.delivery.php at line 141. At the end of the OA_Geo_GeoIP_unpackCookie function, add something like

1
2
3
4
    if ($_SERVER['REMOTE_ADDR'] == 'HERE.IS.YOUR.IP') { // insert your IP
        $aGeoInfo['country_code'] = 'ES'; // insert country code
    }
    return $aGeoInfo;

That’s all, no proxies or messing with your tags or sites required. I hope a similar feature will be added to the plugin sometime in the future. Oh, and I’m not quite sure what would happen if cookies are disabled, but who cares, this is just for testing.

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay

Related posts:

  1. Theme switch and preview plugin

2 Comments

  • Posted by Vincent on 24. April 2009 at 16:14.

    Thank you very much, it’s very usefull to test some of the advertisement.

    But in my version of openx, 2.6.4, the name of the function to modify is OA_Geo_GeoIP_unpackCookie.

    Vincent

    • Posted by nicolas on 24. April 2009 at 18:48.

      Hi Vincent… but I wrote OA_Geo_GeoIP_unpackCookie in my post!? I’m a little confused what you mean.

Leave a Reply

Your email is never shared. Required fields are marked *

*
*