Contains the methods for defining and creating an expanded text ad. For information about builders, see Builders.
Note
Upgrade your expanded text ads to responsive search ads by February 1, 2023. After this date, you will no longer be able to create new or edit existing expanded text ads. For more information, see About responsive search ads.
Existing expanded text ads will continue to serve, and you'll be able to view reports on their performance.
You'll still be able to pause, enable, or remove your expanded text ads. Otherwise, attempts to add or update expanded text ads will result in a CampaignServiceAdTypeInvalid error.
var operation = adGroup.newAd().expandedTextAdBuilder()
.withHeadlinePart1('FIRST PART OF TITLE GOES HERE')
.withHeadlinePart2('SECOND PART OF TITLE GOES HERE')
.withDescription('AD TEXT GOES HERE')
.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`);
}
}
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.
The first part of the ad's title. When Microsoft generates the ad's title using parts 1, 2, and 3 of the title, it concatenates the parts using " - ". Do not specify the dash in any title parts. Each part of the title must contain at least one word. For information about additional title limits and including dynamic text strings in the title, see Bing Ads API.
The second part of the ad's title. When Microsoft generates the ad's title using parts 1, 2, and 3 of the title, it concatenates the parts using " - ". Do not specify the dash in any title parts. Each part of the title must contain at least one word. For information about additional title limits and including dynamic text strings in the title, see Bing Ads API.
The third part of the ad's title. When Microsoft generates the ad's title using parts 1, 2, and 3 of the title, it concatenates the parts using " - ". Do not specify the dash in any title parts. Each part of the title must contain at least one word. For information about additional title limits and including dynamic text strings in the title, see Bing Ads API.
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()).
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.
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.
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?