Associating Bidding Strategy With Shared Budget

69 views
Skip to first unread message

Jesse Malinosky

unread,
Nov 28, 2023, 7:41:06 PM11/28/23
to Google Ads API and AdWords API Forum
I'm looking for some guidance on how to associate a bidding strategy with a shared budget. Referencing the docs it seems like I should be able to do this without issue.

I'm attempting to do so with the following code

public function assignBiddingStrategy() { $campaignBudget = (new CampaignBudget()) ->setResourceName('customers/$CUSTOMER_ID/campaignBudgets/$BUDGET_ID') ->setAlignedBiddingStrategyId($STRATEGY_ID); $campaignBudgetOperation = (new CampaignBudgetOperation()) ->setUpdate($campaignBudget) ->setUpdateMask(FieldMasks::allSetFieldsOf($campaignBudget)); $biddingStrategy = (new BiddingStrategy()) ->setResourceName('customers/$CUSTOMER_ID/biddingStrategies/$STRATEGY_ID') ->setAlignedCampaignBudgetId($BUDGET_ID); $biddingStrategyOperation = (New BiddingStrategyOperation()) ->setUpdate($biddingStrategy) ->setUpdateMask(FieldMasks::allSetFieldsOf($biddingStrategy)); $mutateOperation = (new MutateOperation()) ->setBiddingStrategyOperation($biddingStrategyOperation) ->setCampaignBudgetOperation($campaignBudgetOperation); return $this->googleAdsClient ->getGoogleAdsServiceClient() ->mutate($CUSTOMER_ID, [$mutateOperation]); }

This results in an error

{ "message": "Request contains an invalid argument.", "code": 3, "status": "INVALID_ARGUMENT", "details": [ { "@type": "type.googleapis.com\/google.ads.googleads.v14.errors.GoogleAdsFailure", "errors": [ { "errorCode": { "biddingError": "BIDDING_STRATEGY_AND_BUDGET_MUST_BE_ALIGNED" }, "message": "The attached bidding strategy and budget must be aligned with each other if alignment is specified on either entity.", "trigger": { "int64Value": $STRATEGY_ID }, "location": { "fieldPathElements": [ { "fieldName": "mutate_operations", "index": 0 }, { "fieldName": "campaign_budget_operation" }, { "fieldName": "update" }, { "fieldName": "aligned_bidding_strategy_id" } ] } } ], "requestId": "P5Z7hWMxb71c0sYLx4F4YQ" } ] }


Any thoughts on what I might be doing wrong here, and how to get this to work would be appreciated.

Google Ads API Forum Advisor

unread,
Nov 29, 2023, 2:56:50 AM11/29/23
to jmali...@insiderealestate.com, adwor...@googlegroups.com
Hi Team,

Thank you for reaching out to the Google Ads API support team.

Upon checking your query, you are getting the error "BIDDING_STRATEGY_AND_BUDGET_MUST_BE_ALIGNED". I would suggest you to refer to this link for more information about the error. To investigate further we would request you to provide us with the complete API logs (request and response with request-id and request header) generated at your end and uncropped UI screenshot of where you are facing the issue.

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java, .Net, PHP, Python, Ruby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

You can send the details via Reply privately to the author option, or direct private reply to this email.

 
This message is in relation to case "ref:!00D1U01174p.!5004Q02qVVmA:ref"

Thanks,
 
Google Logo Google Ads API Team


Reply all
Reply to author
Forward
0 new messages