This is the working source code. It changes bid of product partition
group.
$adWordsServices = new AdWordsServices();
$session = $this->getSession();
$adGroupCriterionService = $adWordsServices->get($session,
AdGroupCriterionService::class);
$operations = [];
$adGroupCriterion = new BiddableAdGroupCriterion();
$adGroupCriterion->setAdGroupId(22622716325); // id of my adgroup
$adGroupCriterion->setCriterion(new Criterion(300519082732)); // id of
partition group. you can get find this id in PRODUCT_PARTITION_REPORT in ID
field (which full name is Criterion ID)
//
$bid = new CpcBid();
$money = new Money();
$money->setMicroAmount(((float)4)*1000000);
$bid->setBid($money);
$biddingStrategyConfiguration = new BiddingStrategyConfiguration();
$biddingStrategyConfiguration->setBids([$bid]);
$adGroupCriterion->setBiddingStrategyConfiguration(
$biddingStrategyConfiguration);
$operation = new AdGroupCriterionOperation();
$operation->setOperand($adGroupCriterion);
$operation->setOperator(Operator::SET);
$operations[] = $operation;
//
$adGroupCriterionService->mutate($operations);
вторник, 4 апреля 2017 г., 0:09:58 UTC+3 пользователь Shwetha Vastrad
(AdWords API Team) написал:
>
> Hi Jordan,
>
> As long as you are not changing the structure of your ProductPartition
> <https://developers.google.com/adwords/api/docs/reference/latest/AdGroupCriterionService.ProductPartition>
> tree,
> you can use AdGroupCriterionSerivce.mutate()
> <https://developers.google.com/adwords/api/docs/reference/v201702/AdGroupCriterionService#mutate>
> to
> update just the bid
> <https://developers.google.com/adwords/api/docs/reference/v201702/AdGroupCriterionService.BiddingStrategyConfiguration#bids>
> amount
> of the partition unit. You can use the UpdateKeyword
> <https://github.com/googleads/googleads-php-lib/blob/master/examples/AdWords/v201702/BasicOperations/UpdateKeyword.php>
> PHP
> example as a reference, which updates the final URL of a Keyword. You need
> to modify this example and provide the id of the product partition to
> update the bids
> <https://developers.google.com/adwords/api/docs/reference/v201702/AdGroupCriterionService.BiddingStrategyConfiguration#bids>
> as
> needed. Please note that if the mutate operation would make a tree invalid,
> you must also include the operation that fixes it again in the same
> request. To be valid, all child nodes of a subdivision must have a
> caseValue
> <https://developers.google.com/adwords/api/docs/reference/v201702/AdGroupCriterionService.ProductPartition#casevalue>
> of
> the same type, and every subdivision must contain an "other" node.
>
> Regards,
> Shwetha, AdWords API Team.
>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/fe9fd532-bc66-4c84-8f77-57fce38e799a%40googlegroups.com.