AdsApp.​ResponsiveSearchAdBuilder

Builder for a responsive ad for Search under construction.

Typical usage:

var adOperation = adGroup.newAd().responsiveSearchAdBuilder()
  .withHeadlines([
    "Headline 1",
    { text: "Pinned Headline 2", pinning: "HEADLINE_2"}
  ])
  .addHeadline("Headline 3")
  .addHeadline("Pinned Headline 4", "HEADLINE_2")
  .withDescriptions([
    "Description 1",
    { text: "Pinned Description 2", pinning: "DESCRIPTION_1" }
  ])
  .addDescription("Description 3")
  .addDescription("Pinned Description 4", "DESCRIPTION_1")
  .withPath1("path1")
  .withPath2("path2")
  .withFinalUrl("http://www.example.com")
  .build();
var ad = adOperation.getResult();

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

Methods:

MemberTypeDescription
addDescriptionAdsApp.ResponsiveSearchAdBuilderAdds the provided description to the current list of descriptions.
addHeadlineAdsApp.ResponsiveSearchAdBuilderAdds the provided headline to the current list of headlines.
buildAdsApp.AdOperationCreates a responsive ad for Search.
withCustomParametersAdsApp.ResponsiveSearchAdBuilderSets the custom parameters of the new ad to the specified value.
withDescriptionsAdsApp.ResponsiveSearchAdBuilderSets the new ad's descriptions to the specified value.
withFinalUrlAdsApp.ResponsiveSearchAdBuilderSets the final URL of the new ad to the specified value.
withFinalUrlSuffixAdsApp.ResponsiveSearchAdBuilderSets the final URL suffix of the new ad to the specified value.
withHeadlinesAdsApp.ResponsiveSearchAdBuilderSets the list of the new ad's headlines to the specified value.
withMobileFinalUrlAdsApp.ResponsiveSearchAdBuilderSets the mobile final URL of the new ad to the specified value.
withPath1AdsApp.ResponsiveSearchAdBuilderSets the first path that appears with the new ad's displayed URL.
withPath2AdsApp.ResponsiveSearchAdBuilderSets the second path that appears with the new ad's displayed URL.
withTrackingTemplateAdsApp.ResponsiveSearchAdBuilderSets the tracking template of the new ad to the specified value.

addDescription(description, pinning)

Adds the provided description to the current list of descriptions. At least 2 descriptions must be specified using either this or the withDescriptions() method.

Arguments:

NameTypeDescription
descriptionStringThe text of the description.
pinningStringThe optional pinning location for this ad. If specified, must be one of: "DESCRIPTION_1", or "DESCRIPTION_2".

Return values:

TypeDescription
AdsApp.ResponsiveSearchAdBuilderAd builder with the specified descriptions.

addHeadline(headline, pinning)

Adds the provided headline to the current list of headlines. At least 3 headlines must be specified using either this or the withHeadlines() method.

Arguments:

NameTypeDescription
headlineStringThe text of the headline.
pinningStringThe optional pinning location for this ad. If specified, must be one of: "HEADLINE_1", "HEADLINE_2", or "HEADLINE_3".

Return values:

TypeDescription
AdsApp.ResponsiveSearchAdBuilderAd builder with the specified headlines.

build()

Creates a responsive ad for Search. Returns an AdOperation that can be used to get the new ad (or access any associated errors if creation failed).

Return values:

TypeDescription
AdsApp.AdOperationThe associated ad operation.

withCustomParameters(customParameters)

Sets the custom parameters of the new ad to the specified value.

Custom parameters enable you to create your own ValueTrack parameters that you can assign your own IDs to.

The name of a custom parameter can contain only alphanumeric characters, and custom parameter values may not contain white space. When referring to the custom parameter in final URLs and tracking template, you should surround the custom parameter in braces, and prefix an underscore to its name, e.g. {_param}.

You can have up to 8 custom parameters for an entity. The key and value must not exceed 16 and 200 bytes respectively.

Custom parameters specified at a lower level entity will override the setting specified at a higher level entity, e.g., setting custom parameters at the ad group level overrides the setting at the campaign level, and custom parameters specified at the ad level override the setting at the ad group level.

See Using Upgraded URLs for more information.

Arguments:

NameTypeDescription
customParametersObjectThe custom parameters of the ad as a map of the following form: {key1: 'value1', key2: 'value2', key3: 'value3'}.

Return values:

TypeDescription
AdsApp.ResponsiveSearchAdBuilderThe ad builder with the specified custom parameters.

withDescriptions(descriptions)

Sets the new ad's descriptions to the specified value. At least 2 descriptions must be specified using either this or the addDescription() method.

Arguments:

NameTypeDescription
descriptionsObject[]The ad descriptions. These can either be String instances or if pinning support is required, Asset instances.

Return values:

TypeDescription
AdsApp.ResponsiveSearchAdBuilderAd builder with the specified descriptions.

withFinalUrl(finalUrl)

Sets the final URL of the new ad to the specified value.

The final URL represents the actual landing page for your ad. The final URL must be the URL of the page that the user ends up on after clicking on your ad, once all the redirects have taken place.

See Using Upgraded URLs for more information. This field is required.

Arguments:

NameTypeDescription
finalUrlStringThe final URL for the ad.

Return values:

TypeDescription
AdsApp.ResponsiveSearchAdBuilderThe ad builder with the specified final URL.

withFinalUrlSuffix(suffix)

Sets the final URL suffix of the new ad to the specified value.

When parallel tracking is enabled, the final URL suffix gets appended to the final URL.

Arguments:

NameTypeDescription
suffixStringThe final URL suffix to set on the ad.

Return values:

TypeDescription
AdsApp.ResponsiveSearchAdBuilderThe ad builder with the specified final URL suffix.

withHeadlines(headlines)

Sets the list of the new ad's headlines to the specified value. At least 3 headlines must be specified using either this or the addHeadline() method.

Arguments:

NameTypeDescription
headlinesObject[]The headlines for the ad. These can either be String instances or if pinning support is required, Asset instances.

Return values:

TypeDescription
AdsApp.ResponsiveSearchAdBuilderAd builder with the specified headlines.

withMobileFinalUrl(mobileFinalUrl)

Sets the mobile final URL of the new ad to the specified value.

The mobile final URL represents the actual landing page for your ad on a mobile device. The final mobile URL must be the URL of the page that the user ends up on after clicking on your ad on a mobile device, once all the redirects have taken place.

See Using Upgraded URLs for more information.

Arguments:

NameTypeDescription
mobileFinalUrlStringThe mobile final URL for the ad.

Return values:

TypeDescription
AdsApp.ResponsiveSearchAdBuilderThe ad builder with the specified final URL.

withPath1(urlPath1)

Sets the first path that appears with the new ad's displayed URL.

Arguments:

NameTypeDescription
urlPath1StringThe text of the first path.

Return values:

TypeDescription
AdsApp.ResponsiveSearchAdBuilderAd builder with the specified first URL path.

withPath2(urlPath2)

Sets the second path that appears with the new ad's displayed URL.

Arguments:

NameTypeDescription
urlPath2StringThe text of the second path.

Return values:

TypeDescription
AdsApp.ResponsiveSearchAdBuilderAd builder with the specified second URL path.

withTrackingTemplate(trackingTemplate)

Sets the tracking template of the new ad to the specified value.

You can optionally use the tracking template to specify additional tracking parameters or redirects. Google Ads will use this template to assemble the actual destination URL to associate with the ad.

A tracking template specified at a lower level entity will override the setting specified at a higher level entity, e.g., a tracking template set at the ad group level overrides the setting at the campaign level, and a tracking template specified at the ad level overrides the setting at the ad group level.

See Using Upgraded URLs for more information.

Arguments:

NameTypeDescription
trackingTemplateStringThe tracking template for the ad.

Return values:

TypeDescription
AdsApp.ResponsiveSearchAdBuilderThe ad builder with the specified tracking template.