Stay organized with collections
Save and categorize content based on your preferences.
AI-generated Key Takeaways
The ExpandedTextAdBuilder helps create expanded text ads within Google Ads Scripts, allowing for customization of headlines, descriptions, URLs, and more.
Calling build() on the builder is enough to create the ad, but AdOperation.getResult() is needed if you want to further process the ad (e.g., attach a label).
You can set various parts of the expanded text ad, including headlines (up to three parts), descriptions (up to two), final URL, paths, custom parameters, and tracking template.
Custom parameters let you define your own ValueTrack parameters for tracking and analysis, while tracking templates enable specifying additional tracking or redirects.
This builder provides methods to configure all elements of an expanded text ad, ensuring comprehensive control over your ad content and tracking.
Builder for an expanded text ad under construction.
Typical usage:
varadOperation=adGroup.newAd().expandedTextAdBuilder().withHeadlinePart1("First headline of ad").withHeadlinePart2("Second headline of ad").withDescription("Ad description").withPath1("path1").withPath2("path2").withFinalUrl("http://www.example.com").build();varad=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.
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.
Sets the new ad's first description to the specified value. This field is
required. This method sets the same field as ExpandedTextAdBuilder.withDescription.
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.
Ad builder with the specified third part of the headline.
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.
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.
[[["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-09-23 UTC."],[],[]]