AdsApp.​CampaignBidding

Provides access to a campaign's bidding fields.

Methods:

MemberTypeDescription
argsBuilder AdsApp.BiddingStrategyArgsBuilder Returns a builder that can be used to build up arguments for a bidding strategy.
clearCpcBidCeiling void Clears the cpc bid ceiling if the applied bidding strategy allows it.
clearTargetCpa void Clears the target cpa if the applied bidding strategy allows it.
clearTargetRoas void Clears the target roas if the applied bidding strategy allows it.
getCpcBidCeiling double Returns the cpc bid ceiling (in the account's currency) if the applied bidding strategy has one.
getEnhancedCpcEnabled boolean Returns true if the applied bidding strategy has enhanced cpc enabled.
getLocationFraction double The desired fraction of ads to be shown in the targeted location.
getLocationType String The targeted location for ads to show.
getStrategy AdsApp.BiddingStrategy Returns the flexible bidding strategy of the campaign.
getStrategySource String Returns the bidding strategy source of this campaign.
getStrategyType String Returns the bidding strategy type of this campaign.
getTargetCpa double The target cpa (in the account's currency) of the applied bidding strategy.
getTargetRoas double The target roas of the applied bidding strategy.
setCpcBidCeiling void Sets the cpc bid ceiling (in the account's currency) if the applied bidding strategy allows it.
setEnhancedCpcEnabled void Enables or disables enhanced cpc for the applied bidding strategy.
setLocationFraction void Sets the desired percentage of ads to be shown in the targeted location.
setLocationType void Sets the targeted location for ads.
setStrategy void Sets the bidding strategy of this campaign to the provided portfolio bidding strategy.
setStrategy void Sets the bidding strategy of this campaign to the specified standard bidding strategy.
setStrategy void Sets the bidding strategy of this campaign to the specified standard bidding strategy.
setStrategy void Sets the bidding strategy of this campaign to the specified standard bidding strategy.
setTargetCpa void Sets the target cpa if the applied bidding strategy allows it.
setTargetRoas void Sets the target roas if the applied bidding strategy allows it.

argsBuilder()

Returns a builder that can be used to build up arguments for a bidding strategy. Use with setStrategy to specify arguments needed when applying a bidding strategy.

Return values:

TypeDescription
AdsApp.BiddingStrategyArgsBuilder A builder of arguments for a bidding strategy.

clearCpcBidCeiling()

Clears the cpc bid ceiling if the applied bidding strategy allows it.

Returns nothing.

clearTargetCpa()

Clears the target cpa if the applied bidding strategy allows it. This is the desired amount to spend per conversion. If the applied bidding strategy does not use a target cpa this will throw an error.

Returns nothing.

clearTargetRoas()

Clears the target roas if the applied bidding strategy allows it. This is the desired revenue (based on conversion data) per unit of spend. Value must be a number (representing percentage) between 1.0 and 100000.0, inclusive. If the applied bidding strategy does not use a target roas this will throw an error.

Returns nothing.

getCpcBidCeiling()

Returns the cpc bid ceiling (in the account's currency) if the applied bidding strategy has one. Otherwise returns null.

Return values:

TypeDescription
double The cpc bid ceiling.

getEnhancedCpcEnabled()

Returns true if the applied bidding strategy has enhanced cpc enabled. Returns false if the applied bidding strategy has enhanced cpc disabled. Returns null if the applied bidding strategy type does not make use of enhanced cpc.

Return values:

TypeDescription
boolean A boolean indicating whether enhanced cpc is enabled.

getLocationFraction()

The desired fraction of ads to be shown in the targeted location. Specified as a percentage from 0-100.

Returns null if the applied bidding strategy does not support location fractions.

Return values:

TypeDescription
double The desired percentage of ads to be shown in the targeted location.

getLocationType()

The targeted location for ads to show. Returns null if the applied bidding strategy does not support location types.

Return values:

TypeDescription
String The targeted location for ads to show.

getStrategy()

Returns the flexible bidding strategy of the campaign. If this campaign has an anonymous bidding strategy, or no bidding strategy, null is returned.

Return values:

TypeDescription
AdsApp.BiddingStrategy The flexible bidding strategy associated with this campaign.

getStrategySource()

Returns the bidding strategy source of this campaign. Always returns 'CAMPAIGN'.

Return values:

TypeDescription
String The bidding strategy source of this campaign.

getStrategyType()

Returns the bidding strategy type of this campaign. This may either be an anonymous bidding strategy, or the type of a flexible bidding strategy.

Return values:

TypeDescription
String The strategy type of this campaign.

getTargetCpa()

The target cpa (in the account's currency) of the applied bidding strategy. Returns null if the applied bidding strategy does not have a target cpa.

Return values:

TypeDescription
double The target cpa.

getTargetRoas()

The target roas of the applied bidding strategy. This is the desired revenue (based on conversion data) per unit of spend represented as a percentage. For example, if your goal is to get an average of $5 in sales for each $1 you spend on ads, your target roas would be 500%. Returns null if the applied bidding strategy does not have a target roas.

Return values:

TypeDescription
double The target roas.

setCpcBidCeiling(cpc)

Sets the cpc bid ceiling (in the account's currency) if the applied bidding strategy allows it. If the applied bidding strategy does not use a cpc bid ceiling this will throw an error.

Returns nothing.

Arguments:

NameTypeDescription
cpc double The cpc bid ceiling.

setEnhancedCpcEnabled(enhancedCpcEnabled)

Enables or disables enhanced cpc for the applied bidding strategy. Throws an error if enhanced cpc is not relevant to the applied bidding strategy.

Returns nothing.

Arguments:

NameTypeDescription
enhancedCpcEnabled boolean A boolean indicating whether enhanced cpc is enabled.

setLocationFraction(locationFraction)

Sets the desired percentage of ads to be shown in the targeted location. Specified as a percentage from 0-100.

Throws an error if the applied bidding strategy does not support location fractions.

Returns nothing.

Arguments:

NameTypeDescription
locationFraction double The location fraction.

setLocationType(locationType)

Sets the targeted location for ads. Accepted values are: ANYWHERE_ON_PAGE, TOP_OF_PAGE, ABSOLUTE_TOP_OF_PAGE

Throws an error if the applied bidding strategy does not support location types.

Returns nothing.

Arguments:

NameTypeDescription
locationType String The location type.

setStrategy(biddingStrategy)

Sets the bidding strategy of this campaign to the provided portfolio bidding strategy.

Note that AdsApp does not support creating bidding strategies, so if the desired portfolio bidding strategy does not already exist in your account, you should first create the bidding strategy through the Google Ads user interface, and then access that bidding strategy using BiddingStrategySelector or BiddingStrategyIterator.

Returns nothing.

Arguments:

NameTypeDescription
biddingStrategy AdsApp.BiddingStrategy A portfolio bidding strategy for the campaign.

setStrategy(biddingStrategy)

Sets the bidding strategy of this campaign to the specified standard bidding strategy.

The Google Ads API bidding strategy guide contains a list of all valid standard bidding strategies. Note that specifying portfolio strategies will result in error.

Returns nothing.

Arguments:

NameTypeDescription
biddingStrategy String A string representation of a standard bidding strategy.

setStrategy(biddingStrategy, args)

Sets the bidding strategy of this campaign to the specified standard bidding strategy.

The Google Ads API bidding strategy guide contains a list of all valid standard bidding strategies. Note that specifying portfolio strategies will result in error.

Some bidding strategies support or require specification of additional fields. The exact set of required and optional fields differs for each bidding strategy type.

  campaign.bidding().setStrategy('TARGET_IMPRESSION_SHARE',
  {
    cpcBidCeiling: 1.23,
    locationFraction: 25.7,
    locationType: 'TOP_OF_PAGE'
  });

Bidding Strategy Arguments

All fields are case-sensitive, and so are all values of enumerated fields (such as locationType). The set of required and optional fields differs for each strategy type.

Field Type Description
cpcBidCeiling Double The maximum cpc bid to use. Specified in the account's currency.
enhancedCpcEnabled boolean Whether bids are to be enhanced based on conversion optimizer data. If unspecified, defaults to false.
locationFraction Double The desired fraction of ads to be shown in the targeted location. Specified as a percentage from 0 to 100 (inclusive).
locationType Enum The location on the search results page to target (e.g. 'TOP_OF_PAGE'). For a full list of possible locations see the Google Ads API documentation.
targetRoas Double The target return on ad spend. Specified in the account's currency. Must be between 0.01 and 1000 (inclusive).

Returns nothing.

Arguments:

NameTypeDescription
biddingStrategy String A string representation of a standard bidding strategy.
args AdsApp.BiddingStrategyArgs Javascript map of bidding strategy arguments.

setStrategy(biddingStrategy, argsBuilder)

Sets the bidding strategy of this campaign to the specified standard bidding strategy.

The Google Ads API bidding strategy guide contains a list of all valid standard bidding strategies. Note that specifying portfolio strategies will result in error.

Returns nothing.

Arguments:

NameTypeDescription
biddingStrategy String A string representation of a standard bidding strategy.
argsBuilder AdsApp.BiddingStrategyArgsBuilder Builder of campaign bidding strategy arguments.

setTargetCpa(targetCpa)

Sets the target cpa if the applied bidding strategy allows it. This is the desired amount to spend per conversion. If the applied bidding strategy does not use a target cpa this will throw an error.

Returns nothing.

Arguments:

NameTypeDescription
targetCpa double The target cpa.

setTargetRoas(targetRoas)

Sets the target roas if the applied bidding strategy allows it. This is the desired revenue (based on conversion data) per unit of spend. Value must be a number (representing percentage) between 1.0 and 100000.0, inclusive. If the applied bidding strategy does not use a target roas this will throw an error.

Returns nothing.

Arguments:

NameTypeDescription
targetRoas double The target roas.