Preview Openx geotargeting for different countries

Openx is an 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 worth a look. One of many  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

 
<?php    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.
Published on Jan. 30, 2009 at 12:20 p.m. by Nicolas and tagged advertising, geotargeting, marketing, openx, targeting. You can follow the discussion with the comment feed for this post.

2 comments

  • avatar
    Vincent wrote this comment on April 24, 2009, 4:14 p.m.
    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
    Reply to this comment
    • avatar
      nicolas wrote this comment on April 24, 2009, 6:48 p.m.
      Hi Vincent... but I wrote OA_Geo_GeoIP_unpackCookie in my post!? I'm a little confused what you mean.
      Reply to this comment

Start a new thread

Cancel reply
Markdown. Syntax highlighting with <code lang="php"><?php echo "Hello, world!"; ?></code> etc.