AdsApp.​ShoppingCampaignBidding

Provides access to a shopping campaign's bidding fields.

Methods:

MemberTypeDescription
argsBuilderAdsApp.BiddingStrategyArgsBuilderReturns a builder that can be used to build up arguments for a bidding strategy.
clearCpcBidCeilingvoidClears the cpc bid ceiling if the applied bidding strategy allows it.
clearCpcBidFloorvoidClears the cpc bid floor if the applied bidding strategy allows it.
clearTargetCpavoidClears the target cpa if the applied bidding strategy allows it.
clearTargetRoasvoidClears the target roas if the applied bidding strategy allows it.
getCpcBidCeilingdoubleReturns the cpc bid ceiling (in the account's currency) if the applied bidding strategy has one.
getEnhancedCpcEnabledbooleanReturns true if the applied bidding strategy has enhanced cpc enabled.
getLocationFractiondoubleThe desired fraction of ads to be shown in the targeted location.
getLocationTypeStringThe targeted location for ads to show.
getStrategyAdsApp.BiddingStrategyReturns the flexible bidding strategy of the shopping campaign.
getStrategySourceStringReturns the bidding strategy source of this shopping campaign.
getStrategyTypeStringReturns the bidding strategy type of this shopping campaign.
getTargetCpadoubleThe target cpa (in the account's currency) of the applied bidding strategy.
getTargetRoasdoubleThe target roas of the applied bidding strategy.
setCpcBidCeilingvoidSets the cpc bid ceiling (in the account's currency) if the applied bidding strategy allows it.
setCpcBidFloorvoidSets the cpc bid floor (in the account's currency) if the applied bidding strategy allows it.
setEnhancedCpcEnabledvoidEnables or disables enhanced cpc for the applied bidding strategy.
setLocationFractionvoidSets the desired percentage of ads to be shown in the targeted location.
setLocationTypevoidSets the targeted location for ads.
setStrategyvoidSets the bidding strategy of this shopping campaign to the provided portfolio bidding strategy.
setStrategyvoidSets the bidding strategy of this shopping campaign to the specified standard bidding strategy.
setStrategyvoidSets the bidding strategy of this shopping campaign to the specified standard bidding strategy.
setStrategyvoidSets the bidding strategy of this shopping campaign to the specified standard bidding strategy.
setTargetCpavoidSets the target cpa if the applied bidding strategy allows it.
setTargetRoasvoidSets 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.BiddingStrategyArgsBuilderA builder of arguments for a bidding strategy.

clearCpcBidCeiling()

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

Returns nothing.

clearCpcBidFloor()

Clears the cpc bid floor 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
doubleThe 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
booleanA 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
doubleThe 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
StringThe targeted location for ads to show.

getStrategy()

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

Return values:

TypeDescription
AdsApp.BiddingStrategyThe flexible bidding strategy associated with this shopping campaign.

getStrategySource()

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

Return values:

TypeDescription
StringThe bidding strategy source of this shopping campaign.

getStrategyType()

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

Return values:

TypeDescription
StringThe strategy type of this shopping 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
doubleThe 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
doubleThe 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
cpcdoubleThe cpc bid ceiling.

setCpcBidFloor(cpc)

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

Returns nothing.

Arguments:

NameTypeDescription
cpcdoubleThe cpc bid floor.

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
enhancedCpcEnabledbooleanA 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
locationFractiondoubleThe 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
locationTypeStringThe location type.

setStrategy(biddingStrategy)

Sets the bidding strategy of this shopping 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
biddingStrategyAdsApp.BiddingStrategyA portfolio bidding strategy for the shopping campaign.

setStrategy(biddingStrategy)

Sets the bidding strategy of this shopping 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
biddingStrategyStringA string representation of a standard bidding strategy.

setStrategy(biddingStrategy, args)

Sets the bidding strategy of this shopping 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.

FieldTypeDescription
cpcBidCeilingDoubleThe maximum cpc bid to use. Specified in the account's currency.
enhancedCpcEnabledbooleanWhether bids are to be enhanced based on conversion optimizer data. If unspecified, defaults to false.
locationFractionDoubleThe desired fraction of ads to be shown in the targeted location. Specified as a percentage from 0 to 100 (inclusive).
locationTypeEnumThe 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.
targetRoasDoubleThe target return on ad spend. Specified in the account's currency. Must be between 0.01 and 1000 (inclusive).

Returns nothing.

Arguments:

NameTypeDescription
biddingStrategyStringA string representation of a standard bidding strategy.
argsAdsApp.BiddingStrategyArgsJavascript map of bidding strategy arguments.

setStrategy(biddingStrategy, argsBuilder)

Sets the bidding strategy of this shopping 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
biddingStrategyStringA string representation of a standard bidding strategy.
argsBuilderAdsApp.BiddingStrategyArgsBuilderBuilder of shopping 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
targetCpadoubleThe 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
targetRoasdoubleThe target roas.