gads_set_campaign_bidding_strategy
Google Ads write high risk
Part of the Bidding Agent.
What it does
Set or change a campaign's bidding strategy (MAXIMIZE_CONVERSIONS, MAXIMIZE_CONVERSION_VALUE, TARGET_CPA, TARGET_ROAS, MAXIMIZE_CLICKS, TARGET_SPEND, MANUAL_CPC, or an existing portfolio strategy via bidding_strategy_resource_name). SCALIX SOP PRE-FLIGHT: for TARGET_CPA and TARGET_ROAS the campaign's trailing-30-day metrics.conversions (and conversions_value) are read first — tCPA requires >=30 conversions, tROAS requires >=60 conversions AND recorded conversion value. Below the floor the call is BLOCKED with error_class 'insufficient_conversion_data' and only proceeds when re-called with confirm_below_threshold=true. Any Smart Bidding change also emits a learning-period warning. PREVIEW->APPROVE->COMMIT. Returns {success, data:{applied:{strategy_set, target, learning_period_warning, resource_names}}, warnings}. The preview shows the campaign's current strategy (and portfolio, if any) next to the new one. PREVIEW SEMANTICS: the first call (no preview_id) is sent to the Google Ads API in validation mode — field, enum, policy and permission errors surface AT PREVIEW, nothing is changed, and the response returns a preview_id. To apply, show the preview to the user, get their approval, and re-call with that preview_id and IDENTICAL arguments within 30 minutes; changed arguments or an expired token fail closed to a fresh preview. validate_only=true forces another preview; validate_only=false alone never commits.
When to use it
Ask the goal (leads/purchases/traffic), the desired strategy, and — for tCPA/tROAS — the target value. Prefer MAXIMIZE_CLICKS or MANUAL_CPC on a fresh campaign with no conversion history. This is also the correct tool when a manual keyword bid is blocked.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
customer_id | string | yes | 10-digit CID, dashes/spaces stripped. Tenant context server-derived. |
campaign_id | string | yes | Numeric campaign ID to update. |
strategy_type | string | yes | One of: MANUAL_CPC, MANUAL_CPM, TARGET_SPEND, MAXIMIZE_CONVERSIONS, MAXIMIZE_CONVERSION_VALUE, TARGET_CPA, TARGET_ROAS, TARGET_IMPRESSION_SHARE, or PORTFOLIO (then use bidding_strategy_resource_name). Enum-normalized uppercase. |
target_cpa | number | no | Target CPA in account currency; converted to target_cpa_micros (x1e6, integer). Required for TARGET_CPA; optional for MAXIMIZE_CONVERSIONS. |
target_roas | number | no | Target ROAS as a decimal ratio (4.0 = 400%). Required for TARGET_ROAS; optional for MAXIMIZE_CONVERSION_VALUE. |
cpc_bid_ceiling | number | no | Max CPC bid limit in account currency (converted to micros). REQUIRED when switching to TARGET_SPEND/MAXIMIZE_CLICKS: the update mask cannot express a bare TargetSpend, and a 0 ceiling is rejected by Google as TOO_LOW. |
bidding_strategy_resource_name | string | no | For PORTFOLIO: customers/{cid}/biddingStrategies/{id}. Mutually exclusive with target_cpa / target_roas / cpc_bid_ceiling: passing both is refused. |
validate_only | boolean | no | Optional. true forces another preview even with a preview_id; false is DEPRECATED and no longer commits — only a valid preview_id applies the write. |
confirm_below_threshold | boolean | no | Set true to accept tCPA/tROAS below the Scalix conversion floor (blocked by default). |
preview_id | string | no | Omit it to preview: nothing is applied, and the call returns a preview_id bound to this exact request. Pass it only after the user approves that preview in a later message, with the same arguments (leave out validate_only, and add any confirmation flag the preview names). Single-use, expires in 30 minutes; changed arguments need a fresh preview. |
Safeguards
A change in two steps. The first call previews and changes nothing; Claude shows you the preview and applies it only after you approve, within 30 minutes and with the same arguments. Every applied change goes to the audit log. How changes are approved.
Policy
Bidding-strategy changes carry no content-policy risk but spend real money: never apply a strategy/target the user did not explicitly approve, and never set targets that contradict an account-level constraint without surfacing it.
Reminder
Show current vs proposed strategy with targets in account currency; don't retain account financials beyond this request.
Errors
| Error class | Means | What to do | Retry |
|---|---|---|---|
CUSTOMER_NOT_FOUND | Customer ID not found or not linked. | Verify CID (dashes stripped); re-auth if stale. | no |
TOKEN_REVOKED | Authorization revoked / refresh token expired. | Trigger re-auth (needs_reauth); do not retry with the dead token. | no |
BIDDING_STRATEGY_NOT_SUPPORTED_FOR_CHANNEL | The chosen strategy is incompatible with this campaign's advertising_channel_type (e.g. Manual CPC on PMax). | Surface the platform message; pick a compatible strategy. Branch on channel type. | no |
CANNOT_ATTACH_BIDDING_STRATEGY | Portfolio bidding_strategy can't attach (type mismatch / different currency / not found). | Surface the conflict; verify the strategy resource_name and currency. Do not guess. | no |
MISSING_REQUIRED_TARGET | TARGET_CPA/TARGET_ROAS chosen without the required target value. | Ask the user for target_cpa / target_roas; do not default a number. | no |
INVALID_ARGUMENT | Bad target (e.g. negative tCPA, malformed update_mask). | Surface exact platform message; fix input. Confirm micros conversion. | no |
PERMISSION_DENIED | Missing scope or read-only role. | Report missing scope / role; do not retry. | no |
MANAGER_ACCOUNT_WRITE | Target CID is a manager (MCC) account. | Ask which child serving account to target. | no |
RESOURCE_EXHAUSTED | Rate/quota limit (HTTP 429). | Backoff 5->10->20s cap 60s, honor retryDelay; retry. | yes |
PLATFORM_UNAVAILABLE | Google Ads 5xx / INTERNAL / DEADLINE_EXCEEDED. | Idempotent retry with backoff. | yes |
Edge cases
- target_cpa given in dollars but API needs micros -> convert (x1e6) and show both in preview to avoid 1,000,000x errors.
- Switching off a portfolio strategy to a campaign-level one detaches only this campaign (the others keep the portfolio); the preview shows current_portfolio next to the new strategy.
- Conversion-based strategies (tCPA/tROAS/MaxConv) require active conversion tracking -> if none, surface that bidding will underperform.
- Strategy change resets the learning period -> state expected volatility window.
- bidding_strategy_resource_name with target_cpa / target_roas / cpc_bid_ceiling -> refused before any API call (invalid_argument naming the targets that would be ignored).
- Expired token -> refresh once, retry.
- Preview expired before approval -> re-run validate_only before commit.