Muokkaa

Jaa


ResponsiveSearchAdBuilder

Contains the methods for defining and creating a responsive search ad. For information about builders, see Builders.

Example usage:

    var operation = adGroup.newAd().responsiveSearchAdBuilder()
        .withFinalUrl('LANDING PAGE URL GOES HERE')
        .build();

    // See the Builders topic for performance considerations
    // when using the operation object's methods.
    if (!operation.isSuccessful()) {
        for (var error of operation.getErrors()) {
            Logger.log(`${error}\n`);
        }
    }

Methods

Method Name Return Type Description
addDescription(string description, string pinning) ResponsiveSearchAdBuilder Adds the provided description to the current list of descriptions. At least 2 descriptions must be specified using either this or the addDescription() method.
addHeadline(string headline, string pinning) ResponsiveSearchAdBuilder Adds the provided headline to the current list of headlines. At least 3 headlines must be specified using either this or the addHeadline() method.
build AdOperation Creates the ad and returns an operation object used to check whether Scripts successfully added the ad.
withCustomParameters(Object customParameters) ResponsiveSearchAdBuilder Sets the ad's custom parameters.
withDescriptions(object[] descriptions) ResponsiveSearchAdBuilder Sets the ad's descriptions.
withFinalUrl(string finalUrl) ResponsiveSearchAdBuilder Sets the ad's landing page URL.
withFinalUrlSuffix(string finalUrlSuffix) ResponsiveSearchAdBuilder Sets the ad's final URL suffix.
withHeadlines(object[] headlines) ResponsiveSearchAdBuilder Sets the ad's headlines.
withMobileFinalUrl(string mobileFinalUrl) ResponsiveSearchAdBuilder Sets the ad's final URL for mobile devices.
withPath1(string urlPath1) ResponsiveSearchAdBuilder Sets the first optional path to append to the ad's display URL.
withPath2(string urlPath2) ResponsiveSearchAdBuilder Sets the second optional path to append to the ad's display URL.
withTrackingTemplate(string trackingTemplate) ResponsiveSearchAdBuilder Sets the ad's tracking template.

addDescription(string description, string pinning)

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

Arguments

Name Type Description
description string The ad description to add. For information about limits and including dynamic text strings, see Bing Ads API.
pinning string The optional pinned location.

Possible values for descriptions are: DESCRIPTION_1, DESCRIPTION_2
text string The text of this asset.

Returns

Type Description
ResponsiveSearchAdBuilder Ad builder with the description applied.

addHeadline(string headline, string pinning)

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

Arguments

Name Type Description
headline string The ad headline to add. For information about limits and including dynamic text strings, see Bing Ads API.
pinning string The optional pinned location.

Possible values for headlines are: HEADLINE_1, HEADLINE_2, HEADLINE_3

Returns

Type Description
ResponsiveSearchAdBuilder Ad builder with the headline applied.

build

Creates the ad and returns an operation object used to check whether Scripts successfully added the ad.

For limits on the number of ads you can add to an ad group, see Entity hierarch limits.

Returns

Type Description
AdOperation An operation object used to check whether Scripts successfully added the ad.

withCustomParameters(Object customParameters)

Sets the ad's custom parameters.

Custom parameters are helpful with sharing dynamic information across multiple URLs. For more information about its usage, see Custom Parameters.

Arguments

Name Type Description
customParameters Object A map of up to custom parameters to apply to the ad's final URL. For example, {key1: 'value1', key2: 'value2', key3: 'value3'}, where key is the custom parameter's name and value is the parameter's value. The name may contain a maximum of 16 8-byte characters and the value may contain a maximum of 200 8-byte characters.

Returns

Type Description
ResponsiveSearchAdBuilder Ad builder with the custom parameters applied.

withDescriptions(object[] descriptions)

Sets the ad's descriptions.

Arguments

Name Type Description
descriptions AdTextAsset[] The ad's descriptions. For information about limits and including dynamic text strings, see Bing Ads API.

Returns

Type Description
ResponsiveSearchAdBuilder Ad builder with the descriptions applied.

withFinalUrl(string finalUrl)

Sets the ad's landing page URL.

Arguments

Name Type Description
finalUrl string The ad's landing page URL. For information about URL limits, see Bing Ads API.

Returns

Type Description
ResponsiveSearchAdBuilder Ad builder with the final URL applied.

withFinalUrlSuffix(string finalUrlSuffix)

Sets the ad's final URL suffix.

Arguments

Name Type Description
finalUrl string The ad's final URL suffix. For information about URL limits, see Bing Ads API.

Returns

Type Description
ResponsiveSearchAdBuilder Ad builder with the final URL applied.

withHeadlines(object[] headlines

Sets the ad's headlines.

Arguments

Name Type Description
headlines AdTextAsset[] The ad's headlines. For information about limits and including dynamic text strings, see Bing Ads API.

Returns

Type Description
ResponsiveSearchAdBuilder Ad builder with the ad's headlines applied.

withMobileFinalUrl(string mobileFinalUrl)

Sets the ad's final URL for mobile devices.

The final URL identifies the webpage that the user is taken to when they click the ad. To specify a final URL for mobile devices, first specify a final URL for non-mobile devices (see withFinalUrl()).

For more information, see What tracking or URL parameters can I use?

Arguments

Name Type Description
mobileFinalUrl string The final URL for mobile devices.

Returns

Type Description
ResponsiveSearchAdBuilder Ad builder with the mobile final URL applied.

withPath1(string urlPath1)

Sets the first optional path to append to the ad's display URL.

Arguments

Name Type Description
mobileFinalUrl string The first optional path to append to the ad's display URL. Microsoft uses the domain specified in withFinalUrl as the display URL. If the final URL's domain is contoso.com and the path is shoes, the ad's display URL is contoso.com/shoes. For usage and limits, see Path1.

Returns

Type Description
ResponsiveSearchAdBuilder Ad builder with the path applied.

withPath2(string urlPath2)

Sets the second optional path to append to the ad's display URL.

Arguments

Name Type Description
mobileFinalUrl string The second optional path to append to the ad's display URL. To specify the second path, first specify the first path (see withPath1). Microsoft uses the domain specified in withFinalUrl as the display URL. If the final URL's domain is contoso.com, the first path is shoes, and the second path is ladies, the ad's display URL is contoso.com/shoes/ladies. For usage and limits, see Path2.

Returns

Type Description
ResponsiveSearchAdBuilder Ad builder with the path applied.

withTrackingTemplate(string trackingTemplate)

Sets the ad's tracking template.

Tracking templates are used with the keyword's FinalUrl to create the destination URL used by the ad. For more information, see What tracking or URL parameters can I use?

Arguments

Name Type Description
trackingTemplate string The tracking template to use with this ad.

Returns

Type Description
ResponsiveSearchAdBuilder Ad builder with the tracking template applied.