APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Ad jealousy

I run ads here. I know some people hate advertising, but the money has to come from somewhere. Writing articles and maintaining pages takes a significant amount of time, so advertising is a necessity.

But running the ads has become complicated. As the site has grown, I have more choices of ads to run. There's Google, YPN, Chitika, and I have direct ads too: ads that individual companies have paid for.

There are rules.

Google won't let you run certain types of ads more than once per page. Google won't let you run any other contextual ads on the same page as theirs, or any ads that just look like their ads. Google doesn't let you run ads on certain kinds of pages (search results, newsgroup postings). YPN has similar rules, and so does everyone else. Because I generate ads dynamically rather than hard-coding them into the page, I ended up with a very complicated piece of code to avoid breaking any rules.

There's another problem. I both need and want to control ratios. For example, I might want to give YPN 25% of the pages, but always give page xyz to direct adveriser z. That gets very complicated.

It's time for a rewrite. I've been thinking about how to handle all this, and thought that the easiest way is probably a little database that specifies what ads a page can run. That translates into a fair amount of storage just because of the sheer volume of pages here, and I'd like to avoid that for performance reasons, so my next thought was to generate a hash of the page URL and pick the ad type from that. But then that means that page X always gets ad type X, and that's not good. So I had a better idea: hash the URL, but then look that hash up in a small database that has the ad type to run. That little database can be randomly changed on a daily basis, allowing me to control ratios of ads types to run easily.

So, yet another project. Good thing I don't sleep much.

Got something to add? Send me email.


Increase ad revenue 50-250% with Ezoic

More Articles by

Find me on Google+

© Anthony Lawrence

Sun Nov 13 13:16:46 2005: 1346   MikeHostetler

How about using "tags" on your pages and, based on the tags, you could have a database stored with all the types of ads for each tag name.

If Technorati could use tags, why can't you?

That said, the ad thing seems very complicated. It seems that you just need to write your own state machine to get it right -- that is never fun.

Sun Nov 13 13:25:32 2005: 1347   TonyLawrence

I avoid doing anything that would require me to go back and modify thousands of pages individually. The hash actually eliminates the need for a state machine and is working well already.

By the way, Jim Mohr pointed out that Google has once again loosened up on some of its policies and it is now apparently OK to use Google on pages they formerly didn't like. I guess the competition is affecting them.

Kerio Samepage

Have you tried Searching this site?

Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

All of science is nothing more than the refinement of everyday thinking. (Albert Einstein)

This post tagged: