Proxy Sites - Web Based Proxies

How to geotarget ad delivery using Phproxy and the Maxmind.com GEOIP Lite.

I decided to write a step by step guide on how to geotarget ads to the lower paying countries as I've had a few people ask me how to do it recently.

All you will need is GEOIP Lite from maxminds.com (You can use the commercial version if you like).

The steps:

Step 1.

Download geoip.dat from maxminds.com HERE

Step 2.

Download geoip.inc HERE

Step 3.

Extract the files and upload those 2 files to your domains root directory.

Step 4.

Edit your index.php file and add these lines to the top just under "error_reporting(E_ALL)";.

if (isset($_COOKIE["geo"])){
$country = $_COOKIE['geo'];
} else {
include("http://www.yourdomain.com/geoip.inc");
$gi = geoip_open("/home/YOUR USERNAME PROBABLY GOES HERE/public_html/GeoIP.dat",GEOIP_STANDARD);
$ip = $_SERVER["REMOTE_ADDR"];
$country = geoip_country_code_by_addr($gi, $ip);
geoip_close($gi);
setcookie("geo", $country, time()+15552000); //6 month cookie }
}

Step 5. (inserting ad code into your proxied pages)

Add directly before $_url_form = '

if ($country == "CN") {
$_url_form = 'insert ad code';
}

For non-proxied pages you use anywhere you want to place an ad. (after placing the first bit of code between the "head" tags

if ($country == "CN") {
echo = 'insert ad code';
}

To target additional countries you can modify the code like this

if( $country == "CN" || $country == "IR" || $country == "PL" || $country == "PH")

The country codes can be found in the geoip.inc file

I use PayPopup.com for targetting low paying coutries as they pay 25c cpm for china and atleast 35c for all other countries.


NOTE:
The above guide is for placing popup or popunders into your proxied pages but you can also use the same technique to geotarget banner ads by having two seperate forms.
for eg.

if (country == "US") {
url_form = 'form 1';
} else {
url_form = 'form 2';
}

I left the formatting out of the code as to not break the page so you will need to use the correct syntax that is show in the other code blocks.


Home | Submit Proxy | Advertise | Top 25 | Proxy Categories | Most Recent | Top Visited | Proxy Form| ©2007 Uncensors.com