views:

192

answers:

1

I want to show adsense ads on my search results page.

With Google Custom Search this is easy.

However, I have my own search engine for my site, and I want to show adsense ads on the results page. It doesn't look like this is directly possible.

My thought is to show my own search results, and at the same time call Google's search with the same query in an iframe so I can get the ads and put them in my page. Either in their own iframe, or with JavaScript.

Has anyone done something like this? Do you see any problem with it?

+3  A: 

What you want is the Google AdSense API. The only caveat is that you're required to have a minimum of 100,000 daily pageviews. My company uses this API and it's quite easy to do what you're talking about.

If your site has less than the minimum number of pageviews, well, it seems that you're stuck with the options available from standard AdSense.

Rhinosaurus
Thanks! I'm looking at http://code.google.com/apis/adsense/developer/AdSenseForSearchService.html but even in there it looks like the API returns a snippet of the search box. How do you get just the ads for a particular search query?
Lance Fisher
You could try using the AdSense for Content service API, but this still generates html snippets instead of returning the raw ad data. Unfortunately, it seems that the standard AdSense really restricts what you can do with the ads. I'm used to having the unrestricted API access, but again, they don't just give that away. You could try applying for access... you never know, they just might let you.
Rhinosaurus
Sorry. Here's the link: http://code.google.com/apis/adsense/developer/AdSenseForContentService.html
Rhinosaurus
Cool. So in the full API, there is a method that gets me just the ads for a search query? They must not show the full API in the docs, b/c I can't find that.
Lance Fisher