AdsApp.​ProductAdBuilder

  • Use ProductAdBuilder to create a product ad for a shopping ad group.

  • Calling build() on the ProductAdBuilder is sufficient for creating the product ad unless you need to access the ad for further processing.

  • The build() method returns a ProductAdOperation which can be used to retrieve the newly created product ad or check for errors.

  • Use the withMobilePreferred(isMobilePreferred) method to set the device preference for the new product ad to mobile or clear it.

Builder for a product ad under construction.

Typical usage:

var adOperation = shoppingAdGroup.newAdBuilder().build();
var ad = adOperation.getResult();

Note that it is only necessary to call ProductAdOperation.getResult() if you need to access the actual product ad for further processing (for instance, one can attach a label to the newly created product ad), otherwise, calling ProductAdBuilder.build() on the ProductAdBuilder is sufficient to ensure that the product ad is created.

Methods:

MemberTypeDescription
build() AdsApp.ProductAdOperation Creates a ProductAd.
withMobilePreferred(isMobilePreferred) AdsApp.ProductAdBuilder Sets the new product ad's device preference to mobile or clears it.

build()

Creates a ProductAd. Returns a ProductAdOperation that can be used to get the new product ad (or access any associated errors if creation failed).

Return values:

TypeDescription
AdsApp.ProductAdOperation The associated product ad operation.

withMobilePreferred(isMobilePreferred)

Sets the new product ad's device preference to mobile or clears it. This field is optional and defaults to false.

Arguments:

NameTypeDescription
isMobilePreferred boolean Whether or not this product ad should be mobile preferred. If true is passed in, device preference will be set to mobile. If false is passed in, device preference will be set to none.

Return values:

TypeDescription
AdsApp.ProductAdBuilder Product ad builder with the specified mobile preference.