Google Ads scripts lets you manage bidding for your campaigns. This guide
explains this feature and its use. To set a Google Ads entity's bidding, you
need to specify two parts:

- A [bidding strategy](https://support.google.com/google-ads/answer/2472725)
- The actual bid amount, if applicable

Google Ads scripts provides access to bidding for campaigns through their
`bidding()` method.

## Bidding strategy

A bidding strategy represents a bidding configuration that can be applied to a
Google Ads entity. A bidding strategy can either be anonymous or flexible. You
apply a bidding strategy to a campaign through the `setStrategy()` method of
its `bidding()` property. The following code snippet sets the bidding strategy
of a campaign named **Test Campaign** to `TARGET_SPEND`.

    const campaign = AdsApp.campaigns()
        .withCondition("campaign.name = 'Test Campaign'")
        .get()
        .next();
    campaign.bidding().setStrategy("TARGET_SPEND");

Some types of bidding strategies require extra arguments, which you can provide
using a
[`BiddingStrategyArgsBuilder`](https://developers.google.com/google-ads/scripts/docs/reference/adsapp/adsapp_biddingstrategyargsbuilder):

    const bidding = campaign.bidding();
    bidding.setStrategy(
      'MAXIMIZE_CONVERSION_VALUE',
      bidding.argsBuilder().withTargetRoas(5));

See the
[`setStrategy(biddingStrategy, argsBuilder)`](https://developers.google.com/google-ads/scripts/docs/reference/adsapp/adsapp_campaignbidding#setStrategy_biddingStrategy-argsBuilder)
documentation for full details.

### Anonymous bid strategy

An anonymous bid strategy is applied directly to an entity. Google Ads scripts
supports the following anonymous bid strategies:

| Name | Description |
|---|---|
| MANUAL_CPC | Manual click based bidding where user pays per click. |
| MANUAL_CPM | Manual impression based bidding where user pays per thousand impressions. This can only be used for **Display Network only** campaigns. |
| TARGET_SPEND | Bidding strategy that automatically optimizes clicks per dollar. |
| MAXIMIZE_CONVERSIONS | Bidding strategy that automatically maximizes number of conversions given a daily budget. |
| MAXIMIZE_CONVERSION_VALUE | Bidding strategy that automatically maximizes the total conversion value of your campaign within a specified budget. |
| TARGET_IMPRESSION_SHARE | Bidding strategy that automatically sets bids with the goal of showing your ad on the absolute top of the page, on the top of the page, or anywhere on the page of Google Search results. |

### Flexible bidding strategy

This strategy allows for defining a shared bidding configuration at the account
level. You can then apply the shared bidding configuration to specific
campaigns. You can learn more about this feature in
[our help center](https://support.google.com/google-ads/answer/2979071).

You can retrieve flexible bid strategies in your account as follows:

    const biddingStrategy = AdsApp.biddingStrategies()
        .withCondition("bidding_strategy.name = 'My Shared Bidding Strategy'")
        .get()
        .next();

You can also access the
[campaigns](https://developers.google.com/google-ads/scripts/docs/reference/adsapp/adsapp_biddingstrategy#campaigns)
that are using this bid strategy.

    const campaigns = biddingStrategy.campaigns().get();

One benefit of using a flexible bidding strategy over an anonymous bidding
strategy is that you can track the performance of Google Ads entities sharing
the same bid strategy; for example, to get click stats for your account:

    const clicks = biddingStrategy.getStatsFor("LAST_MONTH").getClicks();

If you need to change the bidding strategy for these entities, modify
the associated shared bidding strategy instead of modifying the bidding
strategy of individual Google Ads entities.