AdsApp.ProductAdBuilder
Stay organized with collections
Save and categorize content based on your preferences.
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:
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:
withMobilePreferred(isMobilePreferred)
Sets the new product ad's device preference to mobile or clears it. This
field is optional and defaults to
false
.
Arguments:
Name | Type | Description |
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:
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-01-28 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-01-28 UTC."],[[["The `ProductAdBuilder` helps create new product ads within a Shopping ad group."],["Calling `build()` on the `ProductAdBuilder` is enough to create the product ad, although `getResult()` is needed for further operations like attaching labels."],["You can optionally set a mobile device preference for the new product ad using `withMobilePreferred()`."],["The `withMobilePreferred()` method takes a boolean argument indicating whether the ad should be preferred on mobile devices or not."]]],[]]