Thank you so much, Vincent.
My bad. I am very sloppy. It works now. All I need to do is to set the
status of the Placement to Manage so that I can get the criterion id. The
Status sets to automatic in which I can't get or see the criterion ID.
Anyways, thank you for helping me with this. I really appreciate it.
Thank you so much,
Ben
On Thursday, October 5, 2017 at 3:44:38 PM UTC+8, Vincent Racaza (AdWords
API Team) wrote:
>
> Hi Ben,
>
> I was able to replicate your issue in my test account. This was due to
> incorrect variable referencing in your code. Please see updates below in
> your PHP code (in *bold*) which works successfully on my end:
>
> public static function runExample(AdWordsServices $adWordsServices,
> AdWordsSession $session, *$AD_GROUP_ID**, $bidModifier*) {
> *$adGroupCriterionService* =
> $adWordsServices->get($session, AdGroupCriterionService::class);
>
> //Create a mobile platform. The ID can be found in the documentation.
> //https://developers.google.com/adwords/api/docs/appendix/platforms
> $desktop= new Platform();
> $desktop->setId(30000); // HighEndMobile = 30001
>
> $urlPlacement = new Placement();
> $urlPlacement->setUrl('listverse.com');
> $urlPlacement->setId('XXXXXXXXXX');
>
> // Create a criterion with modified bid.
> $adGroup = new BiddableAdGroupCriterion();
> $adGroup->setAdGroupId($AD_GROUP_ID );
> $adGroup->setCriterion($urlPlacement);
> $adGroup->setBidModifier($bidModifier);
>
> // Create a campaign criterion operation and add it to the operations
> list.
> $operation = new AdGroupCriterionOperation();
> $operation->setOperator(Operator::SET);
> $operation->setOperand($adGroup);
> $operations = [$operation];
>
> // Update campaign criteria on the server.
> $results = $adGroupCriterionService->mutate($operations);
>
> // Print out some information about the updated campaign criterion.
> foreach ($results->getValue() as *$adGroupCriterion*) {
> printf(
> "Campaign criterion with campaign ID %d, criterion ID %d, "
> . "and type '%s' was modified with bid %.2f.\n",
> *$adGroupCriterion*->getAdGroupId(),
> *$adGroupCriterion*->getCriterion()->getId(),
> *$adGroupCriterion*->getCriterion()->getType(),
> *$adGroupCriterion*->getBidModifier());
> }
> }
>
> Also, if you have further clarifications on this, I suggest to create a
> new forum thread so we can track your concerns better as this concern is
> already on the syntax of your code.
>
> Thanks,
> Vincent
> AdWords API Team
>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords 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 Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/8fcdf570-d7dc-4242-800c-069a6cf38f14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.