Super Simple Geo-Ad-Targeting

I’m upping the anti with figuring out how to best monetise BusSongs.com and most notably begun to experiment with different ad networks and promoting specific products.

Ringtones have proved to be a natural fit, but despite the product being available to users from many countries, it’s became clear that it only generates strong RPMs for a few key markets; namely the UK, US, Ireland and Australia. Consequently, showing the ringtone ad to users outside of these countries presents a large opportunity cost (ie. this screen real estate would generate a higher RPM with a different ad).

Therefore, the ideal solution would be to only show the ringtone ad to select users and show an alternative ad to all other users. Without the desire to upkeep a large-scale and complex ad management solution; I dug around and put together a wee PHP snippet that utilises a free geo-API to lookup the users IP, figure out their geography and then serve up the appropriate ad.

In the wild, it looks something like this (with the actual ad tags removed):

<?php
$ip = $_SERVER[‘REMOTE_ADDR’];
$country = file_get_contents(‘http://api.hostip.info/country.php?ip=’.$ip);
if ($country==”US”) {
echo “<American-English Ringtone Ad Tag>”; }
elseif ($country==”AU” OR $country==”UK” OR $country==”IE”) {
echo “<British-English Ringtone Ad Tag>”; }
else {
echo “<YPN Ad Tag>”; }
?>

The snippet grabs the 2 letter ISO country identifier and dishes out an American-English ad for US visitors, a British-English ad for UK, Australian and Irish users, and then falls back to YPN for everybody else.

The end result is that you’re able to serve the ads that produce the highest monetisation for each individual page impression based upon the user’s physical location. I hope that this proves remotely helpful for others in the same boat.




 Tags: Internet   Published: 2nd August '08


4 Archived Wordpress Comments

john

Keith, try this script: http://www.clippersoft.net/

does the same thing with a few more options, but is more manageable if you want to experiment with various rotations / channels, etc

Keith Mander

Looks almost spot on for my needs. Do you guys actively use it? Can you fix up a bro with a copy to trial out before getting a license?

Carol

pleaseevate this code :

still need SQL database on

Keith Mander

I’m not sure I understand you Carol. Please explain what you need help with.