Hide

AdWordsApp

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

Methods:

MemberTypeDescription
adCustomizerSources AdWordsApp.AdCustomizerSourceSelector Returns the selector of all ad customizer data sources in the account.
adGroups AdWordsApp.AdGroupSelector Returns the selector of all ad groups in the account.
adParams AdWordsApp.AdParamSelector Returns the selector of all ad params in the account.
ads AdWordsApp.AdSelector Returns the selector of all ads in the account.
biddingStrategies AdWordsApp.BiddingStrategySelector Returns the selector of all flexible bidding strategies in the account.
budgets AdWordsApp.BudgetSelector Returns the selector of all budgets in the account.
bulkUploads AdWordsApp.BulkUploads Provides access to bulk uploads: FileUpload, CsvUpload.
campaigns AdWordsApp.CampaignSelector Returns the selector of all campaigns in the account.
createLabel void Creates a new Label.
currentAccount AdWordsApp.Account Returns miscellaneous information about the AdWords account in which the script is currently running.
display AdWordsApp.Display Provides access to display criteria that have been added to this account: Audience, DisplayKeyword, Placement, Topic.
extensions AdWordsApp.Extensions Provides access to ad extensions that have been added to this account: Sitelink, PhoneNumber, MobileApp.
getExecutionInfo AdWordsApp.ExecutionInfo Returns miscellaneous information about the current script execution.
keywords AdWordsApp.KeywordSelector Returns the selector of all keywords in the account.
labels AdWordsApp.LabelSelector Returns the selector of all labels in the account.
newAdCustomizerSourceBuilder AdWordsApp.AdCustomizerSourceBuilder Returns a new ad customizer source builder for this account.
productAds AdWordsApp.ProductAdSelector Returns the selector of all product ads in the account.
productGroups AdWordsApp.ProductGroupSelector Returns the selector of all product groups in the account.
report AdWordsApp.Report Fetches an AdWords report.
shoppingAdGroups AdWordsApp.ShoppingAdGroupSelector Returns the selector of all shopping ad groups in the account.
shoppingCampaigns AdWordsApp.ShoppingCampaignSelector Returns the selector of all shopping campaigns in the account.
targeting AdWordsApp.Targeting Provides access to campaign-level targeting criteria: device targeting, ad scheduling, and location targeting.

adCustomizerSources()

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

Return values:

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

adGroups()

Returns the selector of all ad groups in the account.

Return values:

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

adParams()

Returns the selector of all ad params in the account.

Return values:

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

ads()

Returns the selector of all ads in the account.

Return values:

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

biddingStrategies()

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

Return values:

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

budgets()

Returns the selector of all budgets in the account.

Return values:

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

bulkUploads()

Provides access to bulk uploads: FileUpload, CsvUpload.

Return values:

TypeDescription
AdWordsApp.BulkUploads Access to bulk uploads.

campaigns()

Returns the selector of all campaigns in the account.

Example:

var campaignSelector = AdWordsApp.campaigns();

Return values:

TypeDescription
AdWordsApp.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:

 AdWordsApp.createLabel("My Label");

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

 AdWordsApp.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':
 AdWordsApp.createLabel("Good", "", "#0088FF");

 // WRONG: This will set the description to '#0088FF':
 AdWordsApp.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 AdWords account in which the script is currently running.

Return values:

TypeDescription
AdWordsApp.Account Miscellaneous information about the AdWords 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
AdWordsApp.Display Access to the display criteria that have been added to this account.

extensions()

Provides access to ad extensions that have been added to this account: Sitelink, PhoneNumber, MobileApp.

Return values:

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

getExecutionInfo()

Returns miscellaneous information about the current script execution.

Return values:

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

keywords()

Returns the selector of all keywords in the account.

Return values:

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

labels()

Returns the selector of all labels in the account.

Return values:

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

newAdCustomizerSourceBuilder()

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

Return values:

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

productAds()

Returns the selector of all product ads in the account.

Return values:

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

productGroups()

Returns the selector of all product groups in the account.

Return values:

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

report(query, optArgs)

Fetches an AdWords report.

Example usages:

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

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

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
AdWordsApp.Report The requested report.

shoppingAdGroups()

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

Return values:

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

shoppingCampaigns()

Returns the selector of all shopping campaigns in the account.

Return values:

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

targeting()

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

Return values:

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

Send feedback about...

AdWords Scripts