Hi there,
 
i am receiving an error while trying to add a "Webpage" Criterion to my 
Campaign with CampaignCriterionService.
 
The error i am receiving is: "An error has occurred: 
[CriterionError.CANNOT_ADD_CRITERIA_TYPE @ operations[0].operand.criterion]"
 
The following source code shows that functionality. Is there an error in 
the code, or is it simply not possible to add a Webpage Criterion with 
Adwords API yet?
Please note that i removed my real customer and campaign id in this example.
 

>   $id = "MY_CUSTOMER_ID";

  $campaignId = MY_CAMPAIGN_ID;

  try {

    

   $user = new AdWordsUser();

   $user->LogAll();

   $user->SetClientCustomerId($id);

   $campaignCriterionService = 
> $user->GetService('CampaignCriterionService', ADWORDS_VERSION);

   $param = new WebpageParameter();
>    $param->criterionName = "param1";
>
   $wp = new Webpage();
>
   $wp->parameter = $param;
>
   $campaignCriteria = new CampaignCriterion();
>    $campaignCriteria->campaignId = $campaignId;
>    $campaignCriteria->criterion = $wp;   
>     
>    $operation = new CampaignCriterionOperation();
>    $operation->operand = $campaignCriteria;
>    $operation->operator = 'ADD';
>  
>
   $operations = array();
>    $operations[] = $operation;
>      
>    $result = $campaignCriterionService->mutate($operations);
>      
>    foreach ($result->value as $campaignCriterion) {
>     $this->Session->setFlash("Campaign targeting criterion with ID 
> ".$campaignCriterion->criterion->id." and type 
> ".$campaignCriterion->criterion->CriterionType." was "
>       . "added.");
>    }
>    
>   } catch (Exception $e) {
>    $this->Session->setFlash("An error has occurred: ". $e->getMessage());
>   }
>
 
 
Thank you
 
Best Regards
Bastian 

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

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].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to