SearchAdOptions.Builder

public static final class SearchAdOptions.Builder extends Object

Builds a SearchAdOptions.

Public Constructor Summary

Public Method Summary

SearchAdOptions
build()
Constructs a SearchAdOptions with the specified options.
SearchAdOptions.Builder
setAdType(int adType)
Sets the type of ads to request.
SearchAdOptions.Builder
setAdsafe(String adsafe)
Specifies the filtering rules that Google should apply to ads matching the search query (optional).
SearchAdOptions.Builder
setAdtest(boolean adtest)
Sets whether the request for ads is a test (optional).
SearchAdOptions.Builder
setChannel(String channel)
Sets the channel this ad's performance will be reported under (optional).
SearchAdOptions.Builder
setNumAdsRequested(int numAdsRequested)
Sets the number of ads to request at a time.
SearchAdOptions.Builder
setPersonalizedAds(boolean personalizedAds)
Sets whether ads may be personalized for the user (see documentation at //developers.google.com/custom-search-ads/docs/reference).
SearchAdOptions.Builder
setPrefetch(boolean prefetch)
Sets whether ads will be pre-fetched in the background from the server when the internal ad buffer runs low.

Inherited Method Summary

Public Constructors

public Builder ()

Public Methods

public SearchAdOptions build ()

Constructs a SearchAdOptions with the specified options.

public SearchAdOptions.Builder setAdType (int adType)

Sets the type of ads to request.

See SearchAdOptions.AdType for options. Defaults to AD_TYPE_TEXT.

public SearchAdOptions.Builder setAdsafe (String adsafe)

Specifies the filtering rules that Google should apply to ads matching the search query (optional).

The following are the valid settings for adsafe and the effect each value has on returned ads:

"high" Returns family-safe ads. Does not return non-family-safe or adult sexual content ads.

"medium" Returns family-safe and non-family-safe ads. Does not return adult sexual content ads.

"low" Returns all types of ads.

Defaults to high.

public SearchAdOptions.Builder setAdtest (boolean adtest)

Sets whether the request for ads is a test (optional).

When adtest is true, Google treats the request as a test and does not count the ad impressions or track the clickthrough results. Set this option when testing, but not in production systems or you will not be paid for ads that you display.

Defaults to false.

public SearchAdOptions.Builder setChannel (String channel)

Sets the channel this ad's performance will be reported under (optional).

public SearchAdOptions.Builder setNumAdsRequested (int numAdsRequested)

Sets the number of ads to request at a time.

Defaults to SearchAdOptions.DEFAULT_NUM_ADS.

public SearchAdOptions.Builder setPersonalizedAds (boolean personalizedAds)

Sets whether ads may be personalized for the user (see documentation at //developers.google.com/custom-search-ads/docs/reference).

Defaults to unset.

public SearchAdOptions.Builder setPrefetch (boolean prefetch)

Sets whether ads will be pre-fetched in the background from the server when the internal ad buffer runs low.

Defaults to false.