Today, we are announcing beta support for a new search method in Google Ads scripts. This method is backed by the
Google Ads API and supports most queries supported by that API. Please see the
documentation page for the
AdsApp.search
method for more information.
Additionally, we are adding beta support for the
Google Ads Query Language to our existing
AdsApp.report
method. When using the report method, Google Ads scripts will automatically determine the correct reporting engine (either AdWords API or Google Ads API) to use based on the
FROM
clause in your query.
The key difference between the
report
and
search
methods is in how the results are returned.
- The
report
method will return a Report
object, as it always has. Each row will be a map of column names to values.
- The
search
method will return an iterator of rows, and each row will be analogous to a GoogleAdsRow
in the Google Ads API.
For example, the
campaign.name
column would be accessed using
row['campaign.name']
if you use
report
, and
row.campaign.name
if you use
search
. The flat format from
report
can be useful for exporting to a spreadsheet or CSV. The object format from
search
is useful for programmatically processing results. Additionally, handling repeated fields is more intuitive since they will be returned as true arrays in the object format rather than concatenated together into a single string.
To help you build queries for your search, check out our
query builder tool. If you have any questions, concerns, or feedback on the new beta features, please contact us via our
forum.
- Mike Cloonan, Google Ads scripts Team