SearchAdRequest.Builder

public static final class SearchAdRequest.Builder extends Object

Builds a SearchAdRequest.

Public Constructor Summary

Public Method Summary

SearchAdRequest
build()
Constructs a SearchAdRequest with the specified attributes.
SearchAdRequest.Builder
setHostLanguage(String hostLanguage)
Sets the primary language for the ad.
SearchAdRequest.Builder
setPriceCurrency(String priceCurrency)
Sets the price currency (as case-insensitive three-letter ISO currency code) to use for filtering products by price with setPriceMin(String) and/or setPriceMax(String) (optional).
SearchAdRequest.Builder
setPriceMax(String priceMax)
Sets the maximum product price (in the currency specified with setPriceCurrency(String)) for ads to be returned (optional).
SearchAdRequest.Builder
setPriceMin(String priceMin)
Sets the minimum product price (in the currency specified with setPriceCurrency(String)) for ads to be returned (optional).
SearchAdRequest.Builder
setQuery(String query)
Sets the query entered by the user (required).
SearchAdRequest.Builder
setSpaRestricts(String spaRestricts)
Sets filter options for SPA, as a string of `,` separated list of `key:value` pairs, such as `productttype:beauty,onsale:true`.
SearchAdRequest.Builder
setTestGeolocation(String testGeolocation)
For testing purposes, sets the user's location to return location-targeted shopping ads (optional).

Inherited Method Summary

Public Constructors

public Builder ()

Public Methods

public SearchAdRequest build ()

Constructs a SearchAdRequest with the specified attributes.

public SearchAdRequest.Builder setHostLanguage (String hostLanguage)

Sets the primary language for the ad.

public SearchAdRequest.Builder setPriceCurrency (String priceCurrency)

Sets the price currency (as case-insensitive three-letter ISO currency code) to use for filtering products by price with setPriceMin(String) and/or setPriceMax(String) (optional).

Only valid for Sponsored Product Ads (SPA). Must be specified if setPriceMin(String) or setPriceMax(String) is set. The price filter will not be applied if the provided currency code does not match the currency of the returned ads.

public SearchAdRequest.Builder setPriceMax (String priceMax)

Sets the maximum product price (in the currency specified with setPriceCurrency(String)) for ads to be returned (optional).

Only valid for Sponsored Product Ads (SPA). setPriceCurrency(String) must be set if this option is specified. The price filter will not be applied if the provided currency code does not match the currency of the returned ads.

The given price should contain only numeric characters and periods (e.g. "19.95") and must not contain currency symbols (e.g. "$") or commas (",").

public SearchAdRequest.Builder setPriceMin (String priceMin)

Sets the minimum product price (in the currency specified with setPriceCurrency(String)) for ads to be returned (optional).

Only valid for Sponsored Product Ads (SPA). setPriceCurrency(String) must be set if this option is specified. The price filter will not be applied if the provided currency code does not match the currency of the returned ads.

The given price should contain only numeric characters and periods (e.g. "19.95") and must not contain currency symbols (e.g. "$") or commas (",").

public SearchAdRequest.Builder setQuery (String query)

Sets the query entered by the user (required).

Must not be empty. Should not be URL-encoded.

public SearchAdRequest.Builder setSpaRestricts (String spaRestricts)

Sets filter options for SPA, as a string of `,` separated list of `key:value` pairs, such as `productttype:beauty,onsale:true`.

Only valid for Sponsored Product Ads (SPA). If an incorrectly formatted restrict is supplied, such as `invalid`, the parameter will be ignored and ads will be loaded normally. If a correctly formatted but invalid restrict is supplied, such as `producttype:invalid`, ads will not be loaded.

public SearchAdRequest.Builder setTestGeolocation (String testGeolocation)

For testing purposes, sets the user's location to return location-targeted shopping ads (optional).

Only valid for AdSense for Shopping (AFSh) ads with adtest on. Provide the two-letter country code, case-insensitive.