adsense in ajax search

1 view
Skip to first unread message

jigar

unread,
Jun 8, 2009, 12:40:20 PM6/8/09
to Google AJAX APIs
i have google ajax search and now i want to add adsense to it. Can
someone please help ? I have added as follows but it does not seems
to work.


function onLoadGSearch() {
var options = {
adsOptions: {
client: 'pub-0224090403306930',
adsafe: 'high', // safe ads
language: 'en'
}
};
var searchControl = new google.search.SearchControl();
var drawOptions = new google.search.DrawOptions();

var webSearch = new google.search.WebSearch(options);
webSearch.setUserDefinedLabel("My Web");
webSearch.setUserDefinedClassSuffix("webSearch");
webSearch.setSiteRestriction("jigarshah.net");
searchControl.addSearcher(webSearch);

var siteSearch = new google.search.WebSearch(options);
siteSearch.setUserDefinedLabel("My Blog");
siteSearch.setUserDefinedClassSuffix("siteSearch");
siteSearch.setSiteRestriction("jigarashah.blogspot.com");
searchControl.addSearcher(siteSearch);

drawOptions.setDrawMode
(google.search.SearchControl.DRAW_MODE_LINEAR);
// Tell the searcher to draw itself and tell it where to attach
searchControl.draw(document.getElementById("searchControl"),
drawOptions);
// Execute an inital search
searchControl.execute("");
}

Suresh

unread,
Jun 14, 2009, 12:28:26 PM6/14/09
to Google AJAX APIs
I need urgent help regarding same problem.

Did u find any solutions to this problem?

Nick Hurt

unread,
Jul 23, 2009, 5:03:56 AM7/23/09
to Google AJAX APIs
Was wondering the same thing - possible to add adsense ads in google
ajax search?

Adam Feldman

unread,
Jul 23, 2009, 11:01:39 PM7/23/09
to Google AJAX APIs
Hi guys,

If you want to show ads in your search results, check out the Custom
Search Element:
http://www.google.com/webelements/customsearch/

To fully customize it, see the Control's documentation here:
http://code.google.com/apis/ajaxsearch/documentation/customsearch/index.html

Note that the Custom Search Control extends the Search Control, so a
full list of methods can be found here:
http://code.google.com/apis/ajaxsearch/documentation/reference.html#_class_GSearchControl
Reply all
Reply to author
Forward
0 new messages