Repository navigation
Conversation
kLOsk
left a comment
There was a problem hiding this comment.
Thanks, the core is right. Two things are needed before merging:
- Re-check at apply. Smart Bidding is only checked at draft time. Two drafts (broad match, then Manual CPC) applied in reverse order, or a strategy change in the UI, end up broad with Manual CPC. Please re-read
bidding_strategy_typein_apply_update_campaignand refuse unless it's Smart Bidding. That covers the dry run too. - An accurate preview. Google's help (answer 13389795) says turning it on "will convert all existing phrase and exact match keywords into broad match". The originals show as Removed, and turning it off doesn't restore them. Since September 2026 such campaigns are also upgraded to AI Max. Please say all three in the preview and the docs. UNSPECIFIED stops new conversions, but it doesn't bring back match types.
On your follow-up question: refuse. When bidding_strategy moves a BROAD campaign off Smart Bidding, refuse unless the same call passes keyword_match_type="UNSPECIFIED", so both change in one mutate. Warn that the converted keywords stay broad. Please also rebase once #115 is in.
be03550 to
dc88182
Compare
|
Rebased on
Tests: new tests cover both apply-time refusals (no mutate is sent), the clean apply path, the case where turning broad off doesn't read, and the leaving-Smart-Bidding draft cases. Live account: validate-only dry runs against a paused Maximize clicks campaign:
Nothing was applied. |
|
Thanks, the update covers everything. #116 just landed and conflicts with this one in |
Optional keyword_match_type on update_campaign: BROAD turns campaign-level broad match on, UNSPECIFIED turns it off. Turning it on is refused unless the campaign, or the bidding_strategy in the same plan, is in _SMART_BIDDING_STRATEGIES (the set the BROAD keyword checks use), and needs a double confirmation. The preview says what Google does: every existing phrase and exact keyword is converted to broad (the originals show as Removed and are not restored by turning it off), and since September 2026 such campaigns are upgraded to AI Max. Turning it off takes a single confirmation and says converted keywords stay broad. Moving a campaign with broad match on to a non-Smart bidding_strategy is refused unless the same call passes keyword_match_type=UNSPECIFIED. _apply_update_campaign re-reads bidding_strategy_type and keyword_match_type and refuses both unsafe combinations, so plans applied out of order or a UI change in between cannot leave broad match without Smart Bidding; the dry run runs the same check. draft_campaign is unchanged. Fixes kLOsk#106.
dc88182 to
e0926c5
Compare
|
Rebased on |
Closes #106.
Adds an optional
keyword_match_typetoupdate_campaignonly, with the safety behaviour agreed on the issue.draft_campaignis unchanged, so new campaigns keep Google's default.Values
BROADUNSPECIFIEDTurning it on
campaign.keyword_match_typeandcampaign.bidding_strategy_type.BROADis refused unless the strategy is in_SMART_BIDDING_STRATEGIES, the same set_validate_campaignand the ad-group BROAD-keyword check use. No second list.bidding_strategyin the same plan counts, because both go out in one mutate. Switching toMAXIMIZE_CONVERSIONSand turning broad on together is allowed; switching toMANUAL_CPCtogether with broad on is refused.current_keyword_match_type→keyword_match_type. It warns that the change affects how every keyword in the campaign matches, and setsrequires_double_confirm.BROAD, there's no warning and no double confirmation, because nothing widens.Apply and dry run
keyword_match_typegoes on the existing campaign operation with its ownupdate_maskpath.UNSPECIFIEDunder the mask clears it.validate_onlypath.BROADwas refused at draft, andUNSPECIFIEDcame backDRY_RUN_SUCCESSwithvalidated_calls: 1. Nothing was applied.Rules and tests
.cursor/rules/adloop.mdcnow has the tool table entry and one bullet: what it does, the Smart Bidding rule, and never to turn it on for more traffic on an exact/phrase campaign. Synced.tests/test_campaign_broad_match.py(15 tests) covers:MANUAL_CPCandTARGET_SPENDrefused;update_campaignonly.uv run pytestgives 1678 passed, 2 skipped.One question, not in this PR. If a campaign already has broad on and someone moves it off Smart Bidding with
bidding_strategy, nothing stops that today. Shouldupdate_campaignrefuse, or requirekeyword_match_type="UNSPECIFIED"in the same call? Happy to add it either way.It touches the same functions as #115 and #116; I'll rebase whichever lands later.