Campaign

Contains the methods used to manage a campaign.

Methods

Method Name Return Type Description
addLocation(int locationId) TargetedLocationOperation Creates a location target in this campaign from a location ID.
addLocation(int locationId, double bidModifier) TargetedLocationOperation Creates a location target in this campaign from a location ID and bid modifier.
addNegativeKeywordList(NegativeKeywordList negativeKeywordList) void Adds a negative keyword list to this campaign.
adgroups AdGroupSelector Gets a selector used to filter the list of ad groups in this campaign.
ads AdSelector Gets a selector used to filter the list of ads in this campaign.
applyLabel(string name) void Applies the label to this campaign.
enable void Enables this campaign.
excludeLocation(int locationId) ExcludedLocationOperation Creates a location exclusion in this campaign from a location ID.
getBiddingStrategyType string Gets this campaign's bidding strategy.
getBudget Budget Gets this campaign's budget.
getEntityType string Gets this entity's type.
getId string Gets the ID that uniquely identifies this campaign.
getName string Gets this campaign's name.
getStats Stats Gets this campaign's performance data.
isEnabled boolean Gets a Boolean value that indicates whether this campaign is enabled.
isPaused Boolean Gets a Boolean value that indicates whether this campaign is paused.
isRemoved Boolean Gets a Boolean value that indicates whether this campaign is removed (deleted).
keywords KeywordSelector Gets a selector used to filter the list of keywords in this campaign.
labels LabelSelector Gets a selector used to filter the list of labels associated with this campaign.
newAdGroupBuilder AdGroupBuilder Gets a builder used to add an ad group to this campaign.
pause void Pauses this campaign.
productGroups ProductGroupSelector Gets a selector used to filter the list of product groups in this campaign.
remove void Removes this campaign.
removeLabel(string name) void Removes the label from this campaign.
setName(String name) void Sets this campaign's name.
targeting CampaignTargeting Provides access to campaign level targeting criteria: location targeting.
urls CampaignUrls Gets the methods for managing this campaign's tracking template and custom parameters.

addLocation(int locationId)

Creates a location target in this campaign from a location ID.

Returns

Type Description
TargetedLocationOperation The operation object used to check whether the targeted location was successfully added.

addLocation(int locationId, double bidModifier)

Creates a location target in this campaign from a location ID and bid modifier.

Returns

Type Description
TargetedLocationOperation The operation object used to check whether the targeted location was successfully added.

addNegativeKeywordList(NegativeKeywordList negativeKeywordList)

Adds a negative keyword list to this campaign.

Arguments

Name Type Description
negativeKeywordList NegativeKeywordList The negative keyword list to add to this campaign. A campaign may contain a maximum of 20 lists.

Returns

Type Description
void Returns nothing.

adGroups

Gets a selector used to filter the list of ad groups in this campaign.

Returns

Type Description
AdGroupSelector A selector used to filter the list of ad groups in this campaign.

ads

Gets a selector used to filter the list of ads in this campaign.

Returns

Type Description
AdSelector A selector used to filter the list of ads in this campaign.

applyLabel(string name)

Applies the label to the campaign.

You may apply a maximum of 50 labels to a campaign. For an example that adds a label to an entity, see Using labels.

Arguments

Name Type Description
name string The label's case-sensitive name. To get a list of labels in this account that you can apply, see AdsApp.labels.

Returns

Type Description
void Returns nothing.

enable

Enables this campaign.

Returns

Type Description
void Returns nothing.

excludeLocation(int locationId)

Creates a location exclusion in this campaign from a location ID.

Returns

Type Description
ExcludedLocationOperation The operation object used to check whether the excluded location was successfully added.

getBiddingStrategyType

Gets this campaign's bidding strategy.

Returns

Type Description
string The campaign's bidding strategy. Possible values are:
  • MANUAL_CPC
  • TARGET_SPEND
  • MAXIMIZE_CONVERSIONS
  • ENHANCED_CPC
  • TARGET_CPA
For more information, see Bid Strategies.

getBudget

Gets this campaign's budget.

Returns

Type Description
Budget Contains the methods for managing this campaign's budget.

getEntityType

Gets this entity's type.

Returns

Type Description
string This entity's type, which is Campaign.

getId

Gets the ID that uniquely identifies this campaign.

Returns

Type Description
string The ID that uniquely identifies this campaign.

getName

Gets this campaign's name.

Returns:

Type Description
string The campaign's name.

getStats

Gets this campaign's performance data.

To call this method, you must include one of the forDateRange methods in the campaign selector's chain.

Returns

Type Description
Stats The campaign's performance data.

isEnabled

Gets a Boolean value that indicates whether this campaign is enabled.

Returns

Type Description
boolean Is true if this campaign is enabled; otherwise, false.

isPaused

Gets a Boolean value that indicates whether this campaign is paused.

Returns

Type Description
Boolean Is true if this campaign is paused; otherwise, false.

isRemoved

Gets a Boolean value that indicates whether this campaign is removed (deleted).

Returns

Type Description
Boolean Is true if this campaign is removed; otherwise, false.

keywords

Gets a selector used to filter the list of keywords in this campaign.

Returns

Type Description
KeywordSelector A selector used to filter the list of keywords in this campaign.

labels

Gets a selector used to filter the list of labels associated with this campaign.

Returns

Type Description
LabelSelector A selector used to filter the list of labels associated with this campaign.

newAdGroupBuilder

Gets a builder used to add an ad group to this campaign.

Returns

Type Description
AdGroupBuilder The builder used to add an ad group to this campaign.

pause

Pauses this campaign.

Returns

Type Description
void Returns nothing.

productGroups

Gets a selector used to filter the list of product groups in this campaign.

Returns

Type Description
ProductGroupSelector A selector used to filter the list of product groups in this campaign.

remove

Removes this campaign.

Returns

Type Description
void Returns nothing.

removeLabel(string name)

Removes the label from the campaign.

Arguments

Name Type Description
name string The label's case-sensitive name. To get a list of labels associated with this campaign, see labels.

Returns

Type Description
void Returns nothing.

setName(string name)

Sets the campaign's name.

Arguments

Name Type Description
name string The campaign's name. The name may contain a maximum of 128 characters and must be unique within the account.

Returns

Type Description
void Returns nothing.

targeting

Provides access to campaign level targeting criteria: location targeting.

Returns

Type Description
CampaignTargeting Access to location targeting criteria in this campaign.

urls

Gets the methods for managing this campaign's tracking template and custom parameters.

Returns

Type Description
CampaignUrls Contains the methods for managing this campaign's tracking template and custom parameters.

See also