I'm looking for some guidance on how to associate a bidding strategy with a 
shared budget. Referencing the docs 
<https://developers.google.com/google-ads/api/docs/campaigns/bidding/assign-strategies#link_to_a_shared_budget>
 
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.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/0e886187-567a-4570-a0cd-e1a0bc6eccf8n%40googlegroups.com.

Reply via email to