Saving Your Yahoo Publisher Network (YPN) Account from being BANNED
OK, so digging around it seems like this is still a problem for some people. About 8 months ago there was a bit of buzz surrounding the BETA release of the Yahoo Publisher Network (YPN). Darren Rowse over at problogger.net posted a quote from an email some of the publishers being banned were recieving. It basically stated that publishers who had “too much” non-US traffic using their site and clicking through on their ads were kicked out from the YPN program.
I almost didn’t sign up when I got my invite because of this post. Why would I want to waste my time on something that people were saying was inferior to AdSense. However, I followed through with it, got my account, then got “the call” from a YPN rep asking me how I liked the program. I said hadn’t used it yet but was wondering if I could create some coding to display ads YPN ads to just US users while other ads would be displayed if the user wasn’t from the US.
I then contacted Google and asked them if this was ok and they said, “that doesn’t appear to violate the terms and conditions” blah blah blah. Great, so if you are still worried or having a problem here’s what I did!
PS this uses a wordpress plugin and some PHP, but you get the ID, you can also use some server commands that check the IP of the page viewer but I don’t think that works as well and frankly was making me mad when I first tried it out.
Anyway, the idea is this:
if (visitorIP = us){
display YPN;
}
else{
display AdSense
}
Outline
1. Get your Google AdSense and YPN account if you don’t have one.
2. Populate your database with the IP to Country data
3. Download the IP2Country Wordpress plugin
4. Update your code on your index.php, page.php, single.php, etc with an IF statement.
That’s it, really simple. I had a few problems here and there that I will try and address solutions to but hopefully you will go through the process problem free.
1. Get your Google AdSense and YPN account
Chances are if you are reading this you already have both an AdSense account and a YPN account. If you don’t though visit Google AdSense and Yahoo Publisher to sign-up and get your accounts today.
Those who have the accounts should be familiar with ads and ad code so you can easily insert the code into the files mentioned below.
2. Populate your databasse with the IP to Country data
This was my most problematic part. You need to get the data from the IPtoCountry .csv file into your MySQL database. You can find the Database here and the plugin that I use for this ip2_country has a nice little tutorial about how to create the proper tables.
Create them first then upload your data search the web for how to do this or your mySQL database help file, or you can…
WARNING: I HAVEN’T HAD OTHERS TEST THIS UPLOAD SCRIPT SO PLEASE CHECK TO MAKE SURE THIS IS RIGHT, IT WORKED FOR ME BUT I DON’T WANT TO SCREW UP PEOPLE’S mySQL DATABASE. CHECK IT FIRST
If you need a .php script to do this for you, you can try out the one I used, just copy and past this into an editor, change the appropriate fields where it has
$hostname=yourhost;
$username=yourusername;
$password=”yourpassword”;
$dbid=databaseID;
save it as something.php, upload it and the .csv country list to the same folder at your site, and navigate to it via your browser and presto. You should be getting a long list of what it’s doing, it’s adding the proper info to the ip2country table you made.
3. Download and activate the IP2Country Plugin
Now download and activate the IP to Country Plugin. Should explain itself.
4. Now add code that looks like this
if (wp_ip2c_getCountryCode2(0) == us)
{
print’
Yahoo Publisher Code
‘;
}
else{
print ‘
Google AdSense Code
‘;
}
?>
Put that wherever you want your ads to appear.
As a test below you should see yahoo ads if your from the US and if you’re not you should see Google ads.
Sweet.
Let me know if anyone has any troubles and I can try and help you out or point you in the right direction.
Comments
Comment from 45n5
Time: October 5, 2006, 5:13 pm
Cool Hack!
I’ve seen people being banned from YPN for junky US traffic as well though, e.g. MySpace .
Maybe for version 2 ![]()
Comment from Erik
Time: October 5, 2006, 6:19 pm
Thanks 45n5, I’m thinking of making a plugin for wordpress that combines all these steps and includes an admin panel for easy implentation.
About the MySpace thing, that was pretty interesting to hear about that, maybe there were some user groups formed on myspace that just went around clicking ads? Not sure.
As for junky US traffic. Not sure what to say about that. At least this hack eliminates one of the causes for getting the boot from YPN.
Comment from Flee The Cube
Time: October 6, 2006, 11:54 am
Great idea Erik! I’m gonna have to get off my be-hind and get a YPN account now.
Comment from Erik
Time: October 6, 2006, 12:25 pm
Thanks, I’ve actually been using this for a while, but never got around to writing anything up about it.
Comment from Todd
Time: February 1, 2007, 12:13 am
Neat! I remember the problem coming up quite a while back, great to see there is an easy solution.
Comment from anonymous
Time: January 11, 2008, 7:38 am
This is very unprofessional of Yahoo! to require the webmasters of the WORLD to filter ads. It should be their multi-million dollar corporate problem. Small business that they are targeting just doesn’t have the manpower to implement BS fixes for their laziness. WWW = WORLD Wide Web… not the US Web.
Comment from anonymous
Time: January 11, 2008, 7:40 am
What about those of us who don’t use word press?
Pingback from Erik’s Blog: Board Shorts and Business Suits » Wordpress User Video Upload Script as a PHP Consultant
Time: July 22, 2008, 9:40 pm
[...] php coding for wordpress. I’ve created scripts to populate tables, and custom code to help save your YPN account from being banned. That got reviews on problogger and entrepreneurs [...]
Pingback from How to Target US Traffic for YPN Ads
Time: October 5, 2006, 4:27 pm
[...] If you’re a YPN publisher but are worried about having too much US traffic (they don’t let YPN be used on sites with too many non US readers) then you might find a tip written by Erik helpful on Saving Your Yahoo Publisher Network (YPN) Account from being BANNED. [...]