AdsApp

Root object of Google Ads scripts API. Exposes methods for
  • Fetching Google Ads entities
  • Querying Google Ads reports
  • Accessing information about the state of the current execution

Methods:

MemberTypeDescription
adCustomizerSources AdsApp.AdCustomizerSourceSelector Returns the selector of all ad customizer data sources in the account.
adGroupTargeting AdsApp.AccountAdGroupTargeting Provides access to ad group-level targeting criteria, currently just audiences.
adGroups AdsApp.AdGroupSelector Returns the selector of all ad groups in the account.
adMedia AdsApp.AdMedia Returns the Google Ads media interface.
adParams AdsApp.AdParamSelector Returns the selector of all ad params in the account.
ads AdsApp.AdSelector Returns the selector of all ads in the account.
biddingStrategies AdsApp.BiddingStrategySelector Returns the selector of all flexible bidding strategies in the account.
budgetOrders AdsApp.BudgetOrderSelector Returns the selector of all budget orders in the account.
budgets AdsApp.BudgetSelector Returns the selector of all budgets in the account.
bulkUploads AdsApp.BulkUploads Provides access to bulk uploads: FileUpload, CsvUpload.
campaigns AdsApp.CampaignSelector Returns the selector of all campaigns in the account.
createLabel void Creates a new Label.
currentAccount AdsApp.Account Returns miscellaneous information about the Google Ads account in which the script is currently running.
display AdsApp.Display Provides access to display criteria that have been added to this account: Audience, DisplayKeyword, Placement, Topic.
drafts AdsApp.DraftSelector Returns the selector of all drafts in the account.
excludedPlacementLists AdsApp.ExcludedPlacementListSelector Returns a selector of all excluded placement lists in this account.
experiments AdsApp.ExperimentSelector Returns the selector of all experiments in the account.
extensions AdsApp.Extensions Provides access to ad extensions that have been added to this account: Callout, Message, MobileApp, PhoneNumber, Review, Sitelink, and Snippet.
getExecutionInfo AdsApp.ExecutionInfo Returns miscellaneous information about the current script execution.
keywords AdsApp.KeywordSelector Returns the selector of all keywords in the account.
labels AdsApp.LabelSelector Returns the selector of all labels in the account.
negativeKeywordLists AdsApp.NegativeKeywordListSelector Returns a selector of all negative keyword lists in this account.
newAdCustomizerSourceBuilder AdsApp.AdCustomizerSourceBuilder Returns a new ad customizer source builder for this account.
newExcludedPlacementListBuilder AdsApp.ExcludedPlacementListBuilder Returns a new excluded placement list builder for this account.
newNegativeKeywordListBuilder AdsApp.NegativeKeywordListBuilder Returns a new negative keyword list builder for this account.
productAds AdsApp.ProductAdSelector Returns the selector of all product ads in the account.
productGroups AdsApp.ProductGroupSelector Returns the selector of all product groups in the account.
report AdsApp.Report Fetches a Google Ads report.
shoppingAdGroupTargeting AdsApp.AccountShoppingAdGroupTargeting Provides access to shopping ad group-level targeting criteria, currently just audiences.
shoppingAdGroups AdsApp.ShoppingAdGroupSelector Returns the selector of all shopping ad groups in the account.
shoppingCampaignTargeting AdsApp.AccountShoppingCampaignTargeting Provides access to shopping campaign-level targeting criteria, currently just audiences.
shoppingCampaigns AdsApp.ShoppingCampaignSelector Returns the selector of all shopping campaigns in the account.
targeting AdsApp.Targeting Provides access to campaign-level targeting criteria: device targeting, ad scheduling, location targeting, and audiences.
userlists AdsApp.UserListSelector Returns the selector of all user lists in the account.
videoAdGroups AdsApp.VideoAdGroupSelector Returns the selector of all video ad groups in the account.
videoAds AdsApp.VideoAdSelector Returns the selector of all video ads in the account.
videoCampaigns AdsApp.VideoCampaignSelector Returns the selector of all video campaigns in the account.
videoTargeting AdsApp.VideoTargeting Provides access to video criteria that have been added to this account: VideoAge, VideoAudience, VideoGender, VideoKeyword, VideoMobileAppCategory VideoMobileApplication, VideoParentalStatus, VideoPlacement, VideoTopic, VideoYouTubeChannel, VideoYouTubeVideo.

adCustomizerSources()

Returns the selector of all ad customizer data sources in the account.

Return values:

TypeDescription
AdsApp.AdCustomizerSourceSelector The selector of all ad customizer data sources in the account.

adGroupTargeting()

Provides access to ad group-level targeting criteria, currently just audiences.

Return values:

TypeDescription
AdsApp.AccountAdGroupTargeting Access to ad group-level targeting criteria.

adGroups()

Returns the selector of all ad groups in the account.

Return values:

TypeDescription
AdsApp.AdGroupSelector The selector of all ad groups in the account.

adMedia()

Returns the Google Ads media interface. This supports uploading and fetching media objects.

Return values:

TypeDescription
AdsApp.AdMedia The ad media interface.

adParams()

Returns the selector of all ad params in the account.

Return values:

TypeDescription
AdsApp.AdParamSelector The selector of all ad params in the account.

ads()

Returns the selector of all ads in the account.

Return values:

TypeDescription
AdsApp.AdSelector The selector of all ads in the account.

biddingStrategies()

Returns the selector of all flexible bidding strategies in the account.

Return values:

TypeDescription
AdsApp.BiddingStrategySelector The selector of all flexible bidding strategies in the account.

budgetOrders()

Returns the selector of all budget orders in the account.

Return values:

TypeDescription
AdsApp.BudgetOrderSelector The selector of all budget orders in the account.

budgets()

Returns the selector of all budgets in the account.

Return values:

TypeDescription
AdsApp.BudgetSelector The selector of all budgets in the account.

bulkUploads()

Provides access to bulk uploads: FileUpload, CsvUpload.

Return values:

TypeDescription
AdsApp.BulkUploads Access to bulk uploads.

campaigns()

Returns the selector of all campaigns in the account.

Example:

var campaignSelector = AdsApp.campaigns();

Return values:

TypeDescription
AdsApp.CampaignSelector The selector of all campaigns in the account.

createLabel(name, description, backgroundColor)

Creates a new Label. You must always specify a name, but description and color are optional.

Note that you cannot create more than 100,000 labels per account.

Usage examples:

 AdsApp.createLabel("My Label");

 AdsApp.createLabel("Modified by script", "These ads have been modified by a script");

 AdsApp.createLabel("Bad Keywords", "These keywords are performing poorly", "red");
You must specify optional arguments in order, i.e. you cannot specify color without the description.
 // CORRECT: This will set the color to '#0088FF':
 AdsApp.createLabel("Good", "", "#0088FF");

 // WRONG: This will set the description to '#0088FF':
 AdsApp.createLabel("Bad", "#0088FF");

Returns nothing.

Arguments:

NameTypeDescription
name String The name of the new Label. Label names are case sensitive and must be unique. Max length is 100 characters. Any leading or trailing white spaces will be trimmed.
description String Optional. The description of the new label. If not specified, the description will be empty. Max length is 200 characters.
backgroundColor String Optional. The background color of the new label. The color must be specified in either RGB form (#RRGGBB or #RGB), or one of the 16 basic CSS color names. If not specified, the new label will assume an arbitrary background color.

currentAccount()

Returns miscellaneous information about the Google Ads account in which the script is currently running.

Return values:

TypeDescription
AdsApp.Account Miscellaneous information about the Google Ads account in which the script is currently running.

display()

Provides access to display criteria that have been added to this account: Audience, DisplayKeyword, Placement, Topic.

Return values:

TypeDescription
AdsApp.Display Access to the display criteria that have been added to this account.

drafts()

Returns the selector of all drafts in the account.

Return values:

TypeDescription
AdsApp.DraftSelector The selector of all drafts in the account.

excludedPlacementLists()

Returns a selector of all excluded placement lists in this account.

Return values:

TypeDescription
AdsApp.ExcludedPlacementListSelector A selector of all excluded placement lists in this account.

experiments()

Returns the selector of all experiments in the account.

Return values:

TypeDescription
AdsApp.ExperimentSelector The selector of all experiments in the account.

extensions()

Provides access to ad extensions that have been added to this account: Callout, Message, MobileApp, PhoneNumber, Review, Sitelink, and Snippet.

Return values:

TypeDescription
AdsApp.Extensions Access to ad extensions that have been added to this account.

getExecutionInfo()

Returns miscellaneous information about the current script execution.

Return values:

TypeDescription
AdsApp.ExecutionInfo Miscellaneous information about the current script execution.

keywords()

Returns the selector of all keywords in the account.

Return values:

TypeDescription
AdsApp.KeywordSelector The selector of all keywords in the account.

labels()

Returns the selector of all labels in the account.

Return values:

TypeDescription
AdsApp.LabelSelector The selector of all labels in the account.

negativeKeywordLists()

Returns a selector of all negative keyword lists in this account.

Return values:

TypeDescription
AdsApp.NegativeKeywordListSelector A selector of all negative keyword lists in this account.

newAdCustomizerSourceBuilder()

Returns a new ad customizer source builder for this account. Once AdCustomizerSourceBuilder.build() is called, the ad customizer source will be created in this account.

Return values:

TypeDescription
AdsApp.AdCustomizerSourceBuilder Ad customizer source builder used to create a new ad customizer data source in the account.

newExcludedPlacementListBuilder()

Returns a new excluded placement list builder for this account. Once builder.build() is called, the new excluded placement list will be created in this account.

Return values:

TypeDescription
AdsApp.ExcludedPlacementListBuilder The excluded placement list builder used to create a new excluded placement list in this account.

newNegativeKeywordListBuilder()

Returns a new negative keyword list builder for this account. Once builder.build() is called, the new negative keyword list will be created in this account.

Return values:

TypeDescription
AdsApp.NegativeKeywordListBuilder The negative keyword list builder used to create a new negative keyword list in this account.

productAds()

Returns the selector of all product ads in the account.

Return values:

TypeDescription
AdsApp.ProductAdSelector The selector of all product ads in the account.

productGroups()

Returns the selector of all product groups in the account.

Return values:

TypeDescription
AdsApp.ProductGroupSelector The selector of all product groups in the account.

report(query, optArgs)

Fetches a Google Ads report.

Example usages:

 var report1 = AdsApp.report(
     'SELECT Query, Ctr ' +
     'FROM   SEARCH_QUERY_PERFORMANCE_REPORT ' +
     'DURING 20130101,20130301');

 var report2 = AdsApp.report(
     'SELECT AdGroupId, Id, KeywordText, Impressions, Clicks ' +
     'FROM   KEYWORDS_PERFORMANCE_REPORT ' +
     'DURING 20130101,20130301', {
       includeZeroImpressions: false,
       returnMoneyInMicros: true,
       apiVersion: 'v201802'
     });

Reports are specified via an AWQL query. For detailed information, please see the AWQL guide and the list of report types and fields.

This method also accepts an optional arguments object. The following optional arguments are supported:

NameTypeDescription
includeZeroImpressions boolean Whether or not to include entities that had zero impressions in the report. Defaults to true.
returnMoneyInMicros boolean Whether or not to represent money in micros ('1370000') or in currency ('1.37'). Defaults to false.
apiVersion String The AdWords API version to query. Sunsetted versions are not allowed. Defaults to the most recent supported version.
resolveGeoNames boolean Whether or not to convert Geo CriteriaIds (e.g. CountryCriteriaId and CityCriteriaId) into names (e.g. 'United States' and 'San Francisco'). Set to true if you want names. Set to false if you want numerical IDs. Defaults to true.

Arguments:

NameTypeDescription
query String AWQL query specifying the report.
optArgs Object Optional arguments.

Return values:

TypeDescription
AdsApp.Report The requested report.

shoppingAdGroupTargeting()

Provides access to shopping ad group-level targeting criteria, currently just audiences.

Return values:

TypeDescription
AdsApp.AccountShoppingAdGroupTargeting Access to shopping ad group-level targeting criteria.

shoppingAdGroups()

Returns the selector of all shopping ad groups in the account.

Return values:

TypeDescription
AdsApp.ShoppingAdGroupSelector The selector of all shopping ad groups in the account.

shoppingCampaignTargeting()

Provides access to shopping campaign-level targeting criteria, currently just audiences.

Return values:

TypeDescription
AdsApp.AccountShoppingCampaignTargeting Access to shopping campaign-level targeting criteria.

shoppingCampaigns()

Returns the selector of all shopping campaigns in the account.

Return values:

TypeDescription
AdsApp.ShoppingCampaignSelector The selector of all shopping campaigns in the account.

targeting()

Provides access to campaign-level targeting criteria: device targeting, ad scheduling, location targeting, and audiences.

Return values:

TypeDescription
AdsApp.Targeting Access to campaign-level targeting criteria.

userlists()

Returns the selector of all user lists in the account.

Return values:

TypeDescription
AdsApp.UserListSelector The selector of all user lists in the account.

videoAdGroups()

Returns the selector of all video ad groups in the account.

Return values:

TypeDescription
AdsApp.VideoAdGroupSelector The selector of all video ad groups in the account.

videoAds()

Returns the selector of all video ads in the account.

Return values:

TypeDescription
AdsApp.VideoAdSelector The selector of all video ads in the account.

videoCampaigns()

Returns the selector of all video campaigns in the account.

Return values:

TypeDescription
AdsApp.VideoCampaignSelector The selector of all video campaigns in the account.

videoTargeting()

Provides access to video criteria that have been added to this account: VideoAge, VideoAudience, VideoGender, VideoKeyword, VideoMobileAppCategory VideoMobileApplication, VideoParentalStatus, VideoPlacement, VideoTopic, VideoYouTubeChannel, VideoYouTubeVideo.

Return values:

TypeDescription
AdsApp.VideoTargeting Access to the video criteria that have been added to this account.

Оставить отзыв о...

Текущей странице
Google Ads scripts
Google Ads scripts
Нужна помощь? Обратитесь в службу поддержки.