Hi, I am wondering how I can have a image show only in a certain country. For example Canada Day is coming up and I want to show only my Canadian visitors my Canada Day logo on my site. How can I do this?
I found a nice site after a quick Google search which showed how to display YPN (Yahoo Private Network) ads to only viewers in the US, and Adsense to everyone else. A script like this is probably what you are looking for. If you need more information, you can browse up and down the page linked below. From Website Publisher : "Geotargeting for YPN" Many web publishers are suddenly becoming very interested in geotargeting due to YPN’s policy of banning sites that allow YPN ads to be displayed to non-US visitors. Here’s some example code you can use to display YPN ads only to US visitors and Adsense ads to everyone else: include("geoip.inc"); // include the geoip functions $geofile = geoip_open("GeoIP.dat",GEOIP_STANDARD); // open the geoip data file $cc = geoip_country_code_by_addr($geofile, $_SERVER['REMOTE_ADDR']); geoip_close($geofile); // close the data file if($cc == "US") { // It’s a US visitor. Display YPN ads. Code (markup): // Replace the YPN code below with your own YPN code. // Be sure to precede all "quotes" in the ad code with backslashes as shown in the example. <Large block of Javascript, you can check the site I linked if you want to see it, its just scripts for YPN ads> Be sure to replace the YPN and Adsense codes with your own, and to escape all quotes in the ad code with backslashes \â€like this\â€. Paste or include() this code into your page where you want the geotargeted YPN/Adsense ads to appear and you should be all set.