AdSenseForSearchService (AFS) enables a developer to obtain a code snippet that adds the Google search box to a publisher's web page. The search can be a full web search or restricted to one of several domains. When an end user performs a search, ads are displayed -- when a user clicks through, Google credits a payment.
To generate code snippet for a Google search box, you call the
generateSearchBoxCode operation,
passing in a number of parameters. The
searchType parameter specifies whether the search box has
a choice for searching only the web (GoogleSearch) or also
searching one of several domains you specify (GoogleSiteSearch).
The domains parameter lets you specify that list of
domains and selectedDomain lets you specify the one to
search. SearchBoxStyle lets you
choose the style of the search box.
SearchOptions gives you options for
safe search and showing results in a new window.
SearchResultStyle lets you set custom
colors and logo for search results.
The response to generateSearchBoxCode is an HTML snippet to paste into a web page to render the Google search box.
The version 2 WSDL for this service is at https://www.google.com/api/adsense/v2/AdSenseForSearchService?wsdl.
The version 3 WSDL for this service is at https://www.google.com/api/adsense/v3/AdSenseForSearchService?wsdl.
Requests
Deletes a named search result style from this service.
| Parameter name | Parameter type | Parameter description |
|---|---|---|
| synServiceId | string |
the ID of this service. |
| name | string |
the name of a search result style |
| Response type | Response description |
|---|---|
(none) |
| Error number | Error description |
|---|---|
| 314 | if synServiceType is not valid |
| 915 | if there is no style with the specified name |
Deletes a collection of named search result styles from this service.
| Parameter name | Parameter type | Parameter description |
|---|---|---|
| synServiceId | string |
the ID of this service. |
| names | string[] |
the names of some search result styles |
| Response type | Response description |
|---|---|
(none) |
| Error number | Error description |
|---|---|
| 314 | before deleting any styles if synServiceType is not valid |
| 915 | before deleting any styles if any of the names in names do not correspond to an existing style |
Generates the search ad code snippet that can be dropped into an HTML page for the page to start receiving Google search Ads.
| Parameter name | Parameter type | Parameter description |
|---|---|---|
| synServiceId | string |
the syndication service ID |
| country | string |
the country to determine country specific Google domain.
Must be a
Google supported country. |
| searchType | SearchType |
type of the search ads
Values are:
|
| siteProperties | SiteProperties |
consists of language and encoding. language
is the language for the Button whereas encoding is the encoding
of the site, set encoding to "" to use default value of encoding,
ISO-8859-1 |
| searchOptions | SearchOptions |
consists of isSafeSearch, which can be set
to true to turn on safe search, and showResultsInNewWindow, which
can be set to true to pop up new window when searching. |
| domains | string[] |
for Google site search only, list of domains.
This parameter will be ignored in the case of Google Search
type. |
| selectedDomain | string |
the default domain for sitesearch. Used if
searchType is SearchType.GoogleSiteSearch. This value
is ignored otherwise. Pass value "" for searching web as the default. |
| searchBoxStyle | SearchBoxStyle |
style options of the search ads |
| channelName | string |
the channel that should be used to track statistics
for this page. Only custom channels are allowed. Pass nil if
statistics should not be tracked this page. |
| Response type | Response description |
|---|---|
string |
HTML elements that can be dropped into an HTML page to render a Google search box and button. Google Ads show up in the results of that search. |
| Error number | Error description |
|---|---|
| 314 | if synServiceType is not valid |
| 501 | if channelName is not valid |
| 901 | if some domain in domains are not valid |
| 902 | if selectedDomain is invalid |
| 903 | if backgroundColor background color is not valid or not supported |
| 904 | if textColor text color is not valid or not supported |
| 905 | if adSearchStyleName does not exist |
| 906 | if language is not valid or not supported |
| 907 | if country is not valid or supported |
| 908 | if searchType is not valid |
| 909 | if logoType is not valid |
| 910 | if encoding is not valid |
| 911 | if no domain is specified for site search |
Returns the built-in search result styles created by Google.
| Parameter name | Parameter type | Parameter description |
|---|---|---|
| dummy | int |
a dummy argument |
| Response type | Response description |
|---|---|
SearchResultStyle[] |
an array of search result styles created by Google. |
Returns the channels associated with this syndication service for the publisher.
| Parameter name | Parameter type | Parameter description |
|---|---|---|
| synServiceId | string |
the ID of this service. |
| type | ChannelService_Type |
the ChannelService type of the Channel
Values are:
|
| Response type | Response description |
|---|---|
ChannelService_Data[] |
an array of ChannelService_Data corresponding to the
Channels associated with this service for the publisher. |
| Error number | Error description |
|---|---|
| 314 | if synServiceType is not valid |
| 505 | if type is not valid |
Returns the search result styles created by the publisher.
| Parameter name | Parameter type | Parameter description |
|---|---|---|
| synServiceId | string |
the ID of this service. |
| Response type | Response description |
|---|---|
SearchResultStyle[] |
an array of SearchResultStyles created by the publisher. |
| Error number | Error description |
|---|---|
| 314 | if synServiceType is not valid |
Adds a named search result style. If a search result style with this name is already saved, this will overwrite the style's contents.
| Parameter name | Parameter type | Parameter description |
|---|---|---|
| synServiceId | string |
the ID of this service. |
| searchResultStyle | SearchResultStyle |
a named search result style |
| Response type | Response description |
|---|---|
(none) |
| Error number | Error description |
|---|---|
| 314 | if synServiceType is not valid |
| 905 | if SearchResultStyle's name is not valid |
| 912 | if SearchResultStyle's name is empty |
| 914 | if saving the search result style would go over the saved search result style limit |
| 917 | if any of SearchResultStyle's color is not valid |
| 919 | if the specified logo destination url is invalid |
Adds a collection of named search result styles to this service.
| Parameter name | Parameter type | Parameter description |
|---|---|---|
| synServiceId | string |
the ID of this service. |
| searchResultStyles | SearchResultStyle[] |
an array of named search result styles |
| Response type | Response description |
|---|---|
(none) |
| Error number | Error description |
|---|---|
| 314 | before saving any styles if any element of searchResultStyles has a synServiceType that is not valid |
| 905 | before saving any styles if any element of searchResultStyles has a name that is not valid |
| 912 | before saving any styles if any element of searchResultStyles has a name that is empty |
| 913 | before saving any styles if there are styles with the same name in searchResultStyles |
| 914 | before saving any styles if saving the search result styles would go over the saved search result style limit |
| 917 | before saving any styles if any element of searchResultStyles has a color that is not valid |
| 919 | if the specified logo destination url is invalid |