Issues with adding production partition in shopping campaign with API

1,984 views
Skip to first unread message

Peijun Xu

unread,
May 14, 2014, 4:38:45 PM5/14/14
to adwor...@googlegroups.com
We'are implementing the code to call the adwords api for shopping campaign. We want to use the feature for product partition under the adgroup criterion service.

I created the campaign with shopping type and created the adgroup under the campaign. And then, I tried to run the example code in AddProductPartitionTree.java. It returns the error PRODUCT_PARTITION_ALREADY_EXISTS. I thought it is because of the default production partition had already been created as 'All products'. But this criterion is not removable.

Then I tried to use that default product partition as the parent criterion to create new partition under that. But it returns the error as PRODUCT_PARTITION_UNIT_CANNOT_HAVE_CHILDREN. The default one is a UNIT not a SUBDIVISION.

Also I tried to update the partition type for the default partition to SUBDIVISION. But after running the mutate for update, it's still a unit.

I can manually add product partition under the default one on adwords UI then it could be changed to SUBDIVISION type.

I'm wondering is there any runnable example for the shopping campaign case.

Thanks!

Josh Radcliff (AdWords API Team)

unread,
May 15, 2014, 11:08:00 AM5/15/14
to adwor...@googlegroups.com
Hi,

When you created the campaign, did you create it through the AdWords user interface or by running our AddShoppingCampaign example? If you used the UI, please try creating the campaign via the API and post back if you still have trouble with the partition tree.

Thanks,
Josh, AdWords API Team

Josh Radcliff (AdWords API Team)

unread,
May 15, 2014, 11:25:12 AM5/15/14
to adwor...@googlegroups.com
Hi,

I just ran a few quick tests and found that you can remove the default product partition created when you create the ad group through the UI. Simply issue an AdGroupCriterionService.mutate and pass it a single AdGroupCriterionOperation where the operand is the default product partition and the operator is REMOVE. After that, you should be able to run AddProductPartitionTree.java successfully.

Cheers,
Josh, AdWords API Team

aroxo...@gmail.com

unread,
Jun 5, 2014, 4:01:19 AM6/5/14
to adwor...@googlegroups.com
Hi, 

i am facing next level issue, i have created Adgroup -> Product Partition & Negative Keywords

Now, instead of delete Adgroup , i have to update Adgroup with New set of produdcts and Neg Keywords

1. Delete Exist Product Partition & neg Keywords - how to do it ?

2. Update Exist Product Partition  with latest products ( Add new products + Delete old products) & the same in Neg keywords

Thanks  

Josh Radcliff (AdWords API Team)

unread,
Jun 5, 2014, 9:26:04 AM6/5/14
to adwor...@googlegroups.com
Hi,

This looks like a near-duplicate of your other post from today. Please follow that post so we don't duplicate information.

Thanks,
Josh, AdWords API Team

aroxo...@gmail.com

unread,
Jun 5, 2014, 9:33:38 AM6/5/14
to adwor...@googlegroups.com
Hi,

sure, if need , i will delete the other post now, can you help me out on this?

Thanks

Josh Radcliff (AdWords API Team)

unread,
Jun 5, 2014, 12:18:28 PM6/5/14
to adwor...@googlegroups.com
Hi,

Whenever you want to modify any of the nodes of your ProductPartition tree you must send the entire tree in your AdGroupCriterionService.mutate request. Once your ad group has a ProductPartition tree you cannot delete the tree. Instead, you must submit a mutate request with a SET operation that replaces the entire tree.

Regarding your second question, the tree contains ProductPartitions, not the actual products themselves. If you add new products or update existing products in your Merchant Center account, AdWords will categorize (or recategorize) the products under the corresponding nodes of the tree.

Cheers,
Josh, AdWords API Team

aroxo...@gmail.com

unread,
Jun 6, 2014, 3:59:57 AM6/6/14
to adwor...@googlegroups.com
Hi,

Thanks for the reply, i just tried with the below 

----------------------

$helper = new ProductPartitionHelper($var_adgroup_id);

$root = $helper->createSubdivision2();

$helper->createUnit($root, new ProductOfferId ("gs-001"), 100000);

$result = $adGroupCriterionService->mutate($helper->getOperations());

-----------------
AddProductPartitionTree


 public function createSubdivision2(ProductPartition $parent = null,
      ProductDimension $value = null) {
    $division = new ProductPartition('SUBDIVISION');
    $division->id = $this->nextId--;

    // The root node has neither a parent nor a value
    if (!is_null($parent)) {
      $division->parentCriterionId = $parent->id;
      $division->caseValue = $value;
    }

    $criterion = new BiddableAdGroupCriterion();
    $criterion->adGroupId = $this->adGroupId;
    $criterion->criterion = $division;

    $this->createUpdateOperation($criterion);

    return $division;
  }

private function createUpdateOperation(AdGroupCriterion $criterion) {
    $operation = new AdGroupCriterionOperation();
    $operation->operand = $criterion;
    $operation->operator = 'SET';
    $this->operations[] = $operation;
  }

----------------------------

It through the eror - criterion parent id NOT VALID



 if (!is_null($parent)) {
      $division->parentCriterionId = $parent->id;
      $division->caseValue = $value;
    }

The Above is Causing the ISSUE ?

The Adgroup Product partition have the ID ?  if yes, how can we get that ID 

Thanks 


aroxo...@gmail.com

unread,
Jun 6, 2014, 6:41:50 AM6/6/14
to adwor...@googlegroups.com
Hi,

i got the parentcritition id of product partition using " Adgroupcritition get selector "

now is the way to Empty the Exisitng Product partition by this id and SET new list ?

Thanks

Josh Radcliff (AdWords API Team)

unread,
Jun 9, 2014, 12:19:45 PM6/9/14
to adwor...@googlegroups.com
Hi,

In a single mutate request you should have:

1. An AdGroupCriterionOperation with operator = REMOVE and operand = the AdGroupCriterion of the root ProductPartition (the one with a null parentCriterionId). This is to do a cascading delete of the current product partition tree.
2. AdGroupCriterionOperations with operator = ADD and operand = the AdGroupCriterions for the new ProductPartitions. The collection of ADD operations must create a complete, valid tree.

Below is a sample mutate request where the existing root ProductPartition had criterion ID 18283950120.

Cheers,
Josh, AdWords API Team

            <!-- Operation to REMOVE the current root -->
            <operations>
                <operator>REMOVE</operator>
                <operand xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201402" xsi:type="ns2:BiddableAdGroupCriterion">
                    <ns2:adGroupId>12667430234</ns2:adGroupId>
                    <ns2:criterionUse>BIDDABLE</ns2:criterionUse>
                    <ns2:criterion xsi:type="ns2:ProductPartition">
                        <ns2:id>18283950120</ns2:id>
                        <ns2:type>PRODUCT_PARTITION</ns2:type>
                        <ns2:Criterion.Type>ProductPartition</ns2:Criterion.Type>
                        <ns2:partitionType>SUBDIVISION</ns2:partitionType>
                    </ns2:criterion>
                    <ns2:AdGroupCriterion.Type>BiddableAdGroupCriterion</ns2:AdGroupCriterion.Type>
                </operand>
            </operations>
            <!-- Operations to ADD the new COMPLETE and VALID tree -->
            <operations>
                <operator>ADD</operator>
                <operand xmlns:ns3="https://adwords.google.com/api/adwords/cm/v201402" xsi:type="ns3:BiddableAdGroupCriterion">
                    <ns3:adGroupId>12667430234</ns3:adGroupId>
                    <ns3:criterion xsi:type="ns3:ProductPartition">
                        <ns3:id>-1</ns3:id>
                        <ns3:partitionType>SUBDIVISION</ns3:partitionType>
                    </ns3:criterion>
                </operand>
            </operations>
            <operations>
                <operator>ADD</operator>
                <operand xmlns:ns4="https://adwords.google.com/api/adwords/cm/v201402" xsi:type="ns4:BiddableAdGroupCriterion">
                    <ns4:adGroupId>12667430234</ns4:adGroupId>
                    <ns4:criterion xsi:type="ns4:ProductPartition">
                        <ns4:partitionType>UNIT</ns4:partitionType>
                        <ns4:parentCriterionId>-1</ns4:parentCriterionId>
                        <ns4:caseValue xsi:type="ns4:ProductCanonicalCondition">
                            <ns4:condition>NEW</ns4:condition>
                        </ns4:caseValue>
                    </ns4:criterion>
                    <ns4:biddingStrategyConfiguration>
                        <ns4:bids xsi:type="ns4:CpcBid">
                            <ns4:bid>
                                <ns4:microAmount>200000</ns4:microAmount>
                            </ns4:bid>
                        </ns4:bids>
                    </ns4:biddingStrategyConfiguration>
                </operand>
            </operations>
            <operations>
                <operator>ADD</operator>
                <operand xmlns:ns5="https://adwords.google.com/api/adwords/cm/v201402" xsi:type="ns5:BiddableAdGroupCriterion">
                    <ns5:adGroupId>12667430234</ns5:adGroupId>
                    <ns5:criterion xsi:type="ns5:ProductPartition">
                        <ns5:partitionType>UNIT</ns5:partitionType>
                        <ns5:parentCriterionId>-1</ns5:parentCriterionId>
                        <ns5:caseValue xsi:type="ns5:ProductCanonicalCondition">
                            <ns5:condition>USED</ns5:condition>
                        </ns5:caseValue>
                    </ns5:criterion>
                    <ns5:biddingStrategyConfiguration>
                        <ns5:bids xsi:type="ns5:CpcBid">
                            <ns5:bid>
                                <ns5:microAmount>100000</ns5:microAmount>
                            </ns5:bid>
                        </ns5:bids>
                    </ns5:biddingStrategyConfiguration>
                </operand>
            </operations>
            <operations>
                <operator>ADD</operator>
                <operand xmlns:ns6="https://adwords.google.com/api/adwords/cm/v201402" xsi:type="ns6:BiddableAdGroupCriterion">
                    <ns6:adGroupId>12667430234</ns6:adGroupId>
                    <ns6:criterion xsi:type="ns6:ProductPartition">
                        <ns6:id>-2</ns6:id>
                        <ns6:partitionType>SUBDIVISION</ns6:partitionType>
                        <ns6:parentCriterionId>-1</ns6:parentCriterionId>
                        <ns6:caseValue xsi:type="ns6:ProductCanonicalCondition"/>
                    </ns6:criterion>
                </operand>
            </operations>
            <operations>
                <operator>ADD</operator>
                <operand xmlns:ns7="https://adwords.google.com/api/adwords/cm/v201402" xsi:type="ns7:BiddableAdGroupCriterion">
                    <ns7:adGroupId>12667430234</ns7:adGroupId>
                    <ns7:criterion xsi:type="ns7:ProductPartition">
                        <ns7:partitionType>UNIT</ns7:partitionType>
                        <ns7:parentCriterionId>-2</ns7:parentCriterionId>
                        <ns7:caseValue xsi:type="ns7:ProductBrand">
                            <ns7:value>BrandA</ns7:value>
                        </ns7:caseValue>
                    </ns7:criterion>
                    <ns7:biddingStrategyConfiguration>
                        <ns7:bids xsi:type="ns7:CpcBid">
                            <ns7:bid>
                                <ns7:microAmount>900000</ns7:microAmount>
                            </ns7:bid>
                        </ns7:bids>
                    </ns7:biddingStrategyConfiguration>
                </operand>
            </operations>
            <operations>
                <operator>ADD</operator>
                <operand xmlns:ns8="https://adwords.google.com/api/adwords/cm/v201402" xsi:type="ns8:BiddableAdGroupCriterion">
                    <ns8:adGroupId>12667430234</ns8:adGroupId>
                    <ns8:criterion xsi:type="ns8:ProductPartition">
                        <ns8:partitionType>UNIT</ns8:partitionType>
                        <ns8:parentCriterionId>-2</ns8:parentCriterionId>
                        <ns8:caseValue xsi:type="ns8:ProductBrand">
                            <ns8:value>BrandB</ns8:value>
                        </ns8:caseValue>
                    </ns8:criterion>
                    <ns8:biddingStrategyConfiguration>
                        <ns8:bids xsi:type="ns8:CpcBid">
                            <ns8:bid>
                                <ns8:microAmount>10000</ns8:microAmount>
                            </ns8:bid>
                        </ns8:bids>
                    </ns8:biddingStrategyConfiguration>
                </operand>
            </operations>
            <operations>
                <operator>ADD</operator>
                <operand xmlns:ns9="https://adwords.google.com/api/adwords/cm/v201402" xsi:type="ns9:BiddableAdGroupCriterion">
                    <ns9:adGroupId>12667430234</ns9:adGroupId>
                    <ns9:criterion xsi:type="ns9:ProductPartition">
                        <ns9:id>-3</ns9:id>
                        <ns9:partitionType>SUBDIVISION</ns9:partitionType>
                        <ns9:parentCriterionId>-2</ns9:parentCriterionId>
                        <ns9:caseValue xsi:type="ns9:ProductBrand"/>
                    </ns9:criterion>
                </operand>
            </operations>
            <operations>
                <operator>ADD</operator>
                <operand xmlns:ns10="https://adwords.google.com/api/adwords/cm/v201402" xsi:type="ns10:BiddableAdGroupCriterion">
                    <ns10:adGroupId>12667430234</ns10:adGroupId>
                    <ns10:criterion xsi:type="ns10:ProductPartition">
                        <ns10:partitionType>UNIT</ns10:partitionType>
                        <ns10:parentCriterionId>-3</ns10:parentCriterionId>
                        <ns10:caseValue xsi:type="ns10:ProductBiddingCategory">
                            <ns10:type>BIDDING_CATEGORY_L1</ns10:type>
                            <ns10:value>-5914235892932915235</ns10:value>
                        </ns10:caseValue>
                    </ns10:criterion>
                    <ns10:biddingStrategyConfiguration>
                        <ns10:bids xsi:type="ns10:CpcBid">
                            <ns10:bid>
                                <ns10:microAmount>750000</ns10:microAmount>
                            </ns10:bid>
                        </ns10:bids>
                    </ns10:biddingStrategyConfiguration>
                </operand>
            </operations>
            <operations>
                <operator>ADD</operator>
                <operand xmlns:ns11="https://adwords.google.com/api/adwords/cm/v201402" xsi:type="ns11:BiddableAdGroupCriterion">
                    <ns11:adGroupId>12667430234</ns11:adGroupId>
                    <ns11:criterion xsi:type="ns11:ProductPartition">
                        <ns11:partitionType>UNIT</ns11:partitionType>
                        <ns11:parentCriterionId>-3</ns11:parentCriterionId>
                        <ns11:caseValue xsi:type="ns11:ProductBiddingCategory">
                            <ns11:type>BIDDING_CATEGORY_L1</ns11:type>
                        </ns11:caseValue>
                    </ns11:criterion>
                    <ns11:biddingStrategyConfiguration>
                        <ns11:bids xsi:type="ns11:CpcBid">
                            <ns11:bid>
                                <ns11:microAmount>110000</ns11:microAmount>
                            </ns11:bid>
                        </ns11:bids>
                    </ns11:biddingStrategyConfiguration>
                </operand>
            </operations>
        </mutate>

aroxo...@gmail.com

unread,
Jun 11, 2014, 6:00:41 AM6/11/14
to adwor...@googlegroups.com
Hi Josh ,



Thanks for the reply ,


Now  Remove Exiting Product Partition working fine , i just want to confirm you with below 2 needs

1. am working on " Removal Negative Keywords " on Existing Adgroup, In that criterion is Needed ? 

By the way , how to get the criterion ID for the Negative Keywords ?

2. Here with i attached the screenshot of Adgroup Report for a particular Campaign.

IF i use " REMOVE" for Exisiting Product Partition then, these data's ( clicks,impresssions,CTR etc) will get deleted ?

so whats the difference for "REMOVE" and "SET "

Thanks



 

aroxo...@gmail.com

unread,
Jun 11, 2014, 6:01:52 AM6/11/14
to adwor...@googlegroups.com
Attached Image 
adw_api_ss.png

Josh Radcliff (AdWords API Team)

unread,
Jun 11, 2014, 9:58:51 AM6/11/14
to adwor...@googlegroups.com
Hi,

My responses are below in blue.

Cheers,
Josh, AdWords API Team


On Wednesday, June 11, 2014 6:00:41 AM UTC-4, aroxo...@gmail.com wrote:
Hi Josh ,



Thanks for the reply ,


Now  Remove Exiting Product Partition working fine , i just want to confirm you with below 2 needs

1. am working on " Removal Negative Keywords " on Existing Adgroup, In that criterion is Needed ? 
Sorry, I don't quite understand what you mean here -- the REMOVE operation in my sample XML is to remove the root of the current ProductPartition tree so that the subsequent ADD operations to replace the tree will succeed. 

By the way , how to get the criterion ID for the Negative Keywords ?
You can use a AdGroupCriterionService.get where the Selector includes the Id field. See the Selector Fields page for the list of available fields. If you are looking for Campaign negative keywords, you should use CampaignCriterionService.get instead.

2. Here with i attached the screenshot of Adgroup Report for a particular Campaign.

IF i use " REMOVE" for Exisiting Product Partition then, these data's ( clicks,impresssions,CTR etc) will get deleted ?
No, statistics will remain even for removed items. 

so whats the difference for "REMOVE" and "SET "
REMOVE operations are used to delete objects, while SET operations are used to update objects.

Thanks



 

aroxo...@gmail.com

unread,
Jun 12, 2014, 9:11:17 AM6/12/14
to adwor...@googlegroups.com
Hi Josh,

Thank you for your entire guidance to my questions , it really helps me lot 

Again i have few questions :

1.  I  used " REMOVE"  product partition  for existing Adgroup , After that , if i checked with selector , i got the below

 AdGroupCriterionPage Object
(
    [entries] => 
    [totalNumEntries] => 0
    [PageType] => AdGroupCriterionPage
    [_parameterMap:Page:private] => Array
        (
            [Page.Type] => PageType
        )

)


Next, i have used below code to " Make New Product Partition " , but it seems not working


	$adGroupCriterionService = $user->GetService('AdGroupCriterionService',"v201402");
	
	$helper = new ProductPartitionHelper($var_adgroup_id);		
	
	$root = $helper->createSubdivision();
	
	$helper->createUnit($root, new ProductOfferId("GT_34505"),100000);
	
	
	$helper->createUnit($root,new ProductOfferId());
	
	$result = $adGroupCriterionService->mutate($helper->getOperations());

- I got the 

An error has occurred: [AdGroupCriterionError.PRODUCT_PARTITION_ALREADY_EXISTS @ operations[0].operand.criterion, AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @ operations[1].operand.criterion.parentCriterionId; trigger:'TempCriterionId{id=1}', AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @ operations[2].operand.criterion.parentCriterionId; trigger:'TempCriterionId{id=1}', AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @ operations[3].operand.criterion.parentCriterionId; trigger:'TempCriterionId{id=1}', 

---------------------------------

2. can we have any Functions to get the status of Account 

for example : howmany operations we did today ?  like that 

Looking forward your help

Thanks 

Josh Radcliff (AdWords API Team)

unread,
Jun 12, 2014, 12:34:48 PM6/12/14
to adwor...@googlegroups.com
Hi,

Please see my responses below in blue.

Cheers,
Josh, AdWords API Team


On Thursday, June 12, 2014 9:11:17 AM UTC-4, aroxo...@gmail.com wrote:
Hi Josh,

Thank you for your entire guidance to my questions , it really helps me lot 

Again i have few questions :

1.  I  used " REMOVE"  product partition  for existing Adgroup , After that , if i checked with selector , i got the below

 AdGroupCriterionPage Object
(
    [entries] => 
    [totalNumEntries] => 0
    [PageType] => AdGroupCriterionPage
    [_parameterMap:Page:private] => Array
        (
            [Page.Type] => PageType
        )

)


Next, i have used below code to " Make New Product Partition " , but it seems not working


	$adGroupCriterionService = $user->GetService('AdGroupCriterionService',"v201402");
	
	$helper = new ProductPartitionHelper($var_adgroup_id);		
	
	$root = $helper->createSubdivision();
	
	$helper->createUnit($root, new ProductOfferId("GT_34505"),100000);
	
	
	$helper->createUnit($root,new ProductOfferId());
	
	$result = $adGroupCriterionService->mutate($helper->getOperations());

- I got the 

An error has occurred: [AdGroupCriterionError.PRODUCT_PARTITION_ALREADY_EXISTS @ operations[0].operand.criterion, AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @ operations[1].operand.criterion.parentCriterionId; trigger:'TempCriterionId{id=1}', AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @ operations[2].operand.criterion.parentCriterionId; trigger:'TempCriterionId{id=1}', AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @ operations[3].operand.criterion.parentCriterionId; trigger:'TempCriterionId{id=1}', 
That code should work, although I noticed that the error references a TempCriterionId of positive 1, but TempCriterionId values should be negative. Have you made any changes to the ProductPartitionHelper?
 


---------------------------------

2. can we have any Functions to get the status of Account 

for example : howmany operations we did today ?  like that 
Please see the discussion on operation counts here. Also, when posting to the forum, could you create a separate post for unrelated questions? To make search results more meaningful to forum users, we like to have topics that focus on one particular area.

aroxo...@gmail.com

unread,
Jun 13, 2014, 9:47:47 AM6/13/14
to adwor...@googlegroups.com
Hi,

I can do the following things:

1. Create New AdGroup -> Create Product Partition -> Add Negative Keywords

2.  Delete Products on Product Partition , Delete Negative keywords using AdGroup ID ,

-----

i CAN:T do the following :

1. Create Product Paritition on Empty Adgroup ( Adgroup Empty Process done API )

As you said, operations[1].operand.criterion.parentCriterionId; trigger:'TempCriterionId{id=1}'   with .PRODUCT_PARTITION_DOES_NOT_EXIST

Can you say " which are possible errors cause TempCriterionId{id=1} " ?

Thanks 

Josh Radcliff (AdWords API Team)

unread,
Jun 13, 2014, 9:51:49 AM6/13/14
to adwor...@googlegroups.com
Hi,

Could you post the XML request and response you are sending when trying to create a ProductPartition on an empty AdGroup? Please make sure that you remove any sensitive information from the XML, per the forum rules.

Thanks,
Josh, AdWords API Team

aroxo...@gmail.com

unread,
Jun 16, 2014, 9:16:29 AM6/16/14
to adwor...@googlegroups.com
Hi Josh,

Thanks for your support.

1. Create Product Paritition on Empty Adgroup ( Adgroup Empty Process done API ) - Its DONE now.

Now the issue is :

i can;t able to delete product partition in Single Mutate , By the way my code is :

$adGroupId= "123456";

//Create selector.
$selector = new Selector();
$selector->fields = array('AdGroupId');
$selector->ordering = array(new OrderBy('Id', 'ASCENDING'));

// Create predicates.
$selector->predicates[] = new Predicate('AdGroupId', 'IN', array($));
$selector->predicates[] = new Predicate('CriteriaType', 'IN', array('PRODUCT_PARTITION'));
$selector->predicates[] = new Predicate('CriterionUse', 'IN', array('BIDDABLE'));

$result = $adGroupCriterionService->get($selector);

//echo '<pre>'; print_r($result); echo '</pre>'; //die;

$varProductPartitionCount = $result->totalNumEntries;

$operations         = array();
$arrCriterionIds     = array();

if($varProductPartitionCount>0 ) {

  $operations = array();

    for($varPPCount=0;$varPPCount<$varProductPartitionCount;$varPPCount++)
    {
        $arrCriterionIds[] = $result->entries[$varPPCount]->criterion->id;
    }
   
    //echo '<hr>'; echo '<pre>';print_r($arrCriterionIds); echo '</pre>'; echo '<hr>';
   
    for($varCriterionCnt=0;    $varCriterionCnt<count($arrCriterionIds);$varCriterionCnt++)
    {
        $criterionId= $arrCriterionIds[$varCriterionCnt];
        $criterion = new Criterion();
        $criterion->id = $criterionId;
       
        // Create ad group criterion.
        $adGroupCriterion = new AdGroupCriterion();
        $adGroupCriterion->adGroupId = $adGroupId;
        $adGroupCriterion->criterion = new Criterion($criterionId);
       
        // Create operation.
        $operation = new AdGroupCriterionOperation();
        $operation->operand = $adGroupCriterion;
        $operation->operator = 'REMOVE';

        $operations[] = $operation;
       
       
    }
   
    $result= $adGroupCriterionService->mutate($operations);   
   
}  


if i given " Mutate " Request within  " Foreach " , its works fine

* My xml request and response  is attached

* Error is below


Fatal error: Uncaught SoapFault exception: [soap:Server] [AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @ operations[1].operand.criterion.id, AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @ operations[2].operand.criterion.id] in /var/www/bathrooms/adwords-api/Google/Api/Ads/Common/Lib/AdsSoapClient.php:216 Stack trace: #0 /var/www/bathrooms/adwords-api/Google/Api/Ads/Common/Lib/AdsSoapClient.php(216): SoapClient->__soapCall('mutate', Array, NULL, Array, Array) #1 /var/www/bathrooms/adwords-api/Google/Api/Ads/AdWords/v201402/AdGroupCriterionService.php(8712): AdsSoapClient->__soapCall('mutate', Array) #2 /var/www/bathrooms/adwords-api/alter_products_new.php(70): AdGroupCriterionService->mutate(Array) #3 {main} thrown in /var/www/bathrooms/adwords-api/Google/Api/Ads/Common/Lib/AdsSoapClient.php on line 216


Thanks



sample.txt

Josh Radcliff (AdWords API Team)

unread,
Jun 16, 2014, 9:48:17 AM6/16/14
to adwor...@googlegroups.com
Hi,

Please see my earlier reply from June 9th -- when removing the tree your mutate operations should just contain a single REMOVE operation where the operand is the root of the current ProductPartition tree. You could achieve this in your code by only capturing the criterion ID of the ProductPartition with a null parentCriterionId (in other words, the root node).

    for($varPPCount=0;$varPPCount<$varProductPartitionCount;$varPPCount++)
    {
        // Only do the next line if $result->entries[$varPPCount]->criterion->parentCriterionId is null
        $arrCriterionIds[] = $result->entries[$varPPCount]->criterion->id;
    }

aroxo...@gmail.com

unread,
Jun 17, 2014, 7:09:57 AM6/17/14
to adwor...@googlegroups.com
Hi,

Yes i understood your point.

Delete Product Partition :

1. we can have single REMOVE and mutate request , if we had  " parentCriterionId " 

2. If we dont have "parentCriterionId"  , then we will collect all the criterion ID and  use Each One Mutate Request for each ID.

----------------
My Question is :

i have created the Product Partition , Please have a look at this place  here , then if i get Adgroup details,

It wont have " parentCriterionId",  i used same "createSubdivision" .

here with i attached the XML reponse  & Selector Result

Please have a look at selector result, i dont have any Criterion ID without NULL,

i need to have Parent Criterion ID to make SINGLE REMOVE in order to delete product Partition
selector_result.txt
xml_response.txt

Josh Radcliff (AdWords API Team)

unread,
Jun 17, 2014, 1:24:54 PM6/17/14
to adwor...@googlegroups.com
Hi,

In the Selector you used for your AdGroupCriterionService.get request, did you include the field "ParentCriterionId"? Your logs suggest that you did not, since it would be impossible for a single ad group to have multiple ACTIVE AdGroupCriterion objects with a ProductPartition having a null parentCriterionId. In other words, there can be only one root ProductPartition for an ad group at any given time.

Regarding your statement "Please have a look at selector result, i dont have any Criterion ID without NULL," -- you will never have an AdGroupCriterion with criterionId of null since that's a required field. However, the one with a ProductPartition where parentCriterionId is null will be the root of your partition tree.

Cheers,
Josh, AdWords API Team

aroxo...@gmail.com

unread,
Jun 18, 2014, 8:28:40 AM6/18/14
to adwor...@googlegroups.com
Hi ,

Sorry i can;t understand.

I knew, Each Adgroup have ONLY ONE parentCriterionId ( i-e NOT NULL  or NOT Empty ),

i Just wanted to know about,

1. i created Adgroup using following code 

$adGroupService = $user->GetService('AdGroupService', ADWORDS_VERSION); 

// Create ad group.
$adGroup = new AdGroup();
$adGroup->campaignId = "24589366";
$adGroup->name = "pla-test";
// Create operation.
$operation = new AdGroupOperation();
$operation->operand = $adGroup;
$operation->operator = 'ADD';
// Make the mutate request.
$result = $adGroupService->mutate(array($operation));

2. using created Adgroup id, i have used selection to get Adgroup details ( my Selection code in previous post, i tried with "parentCriterionId  " as selection field too today)

But i didn't get Any Product Partition with parentCriterionId   HAS VALUE.

if i get the parentCriterionId   has value , i can make single REMOVE mutate request to delete all product partition within the Adgroup


Thanks 




Josh Radcliff (AdWords API Team)

unread,
Jun 19, 2014, 12:42:26 PM6/19/14
to adwor...@googlegroups.com
Hi,

The campaign ID you mentioned is a Search Network Only campaign, not a Shopping campaign. Have you tried this with a Shopping campaign? Also, when you create an ad group through the API, AdWords will not automatically create AdGroupCriterion objects for you, so it makes sense that you were not able to find any AdGroupCriterion objects immediately after ADDing the AdGroup.

Regarding removing the product partitions, I would not pass all of the product partitions in a single mutate request. Using that approach, it's highly likely you'll run into the PRODUCT_PARTITION_DOES_NOT_EXIST error you mentioned earlier because of the dependencies between all of the ProductPartitions. For example, if you have a product partition tree like this:

           A
          / \
         B   C
            / \
           D   E

and you passed REMOVE operations for A, B, C, D, and E in a single mutate request in that order, then AdWords will:

1. Perform the REMOVE of A, which will automatically remove not only A but B, C, D, and E as well because they are children of A
2. Attempt to perform the REMOVE of B but throw a PRODUCT_PARTITION_DOES_NOT_EXIST because B was already removed as part of the previous operation

Instead, you should simply pass a single REMOVE operation for A in your mutate request.

Thanks,
Josh, AdWords API Team

aroxo...@gmail.com

unread,
Jun 20, 2014, 10:17:16 AM6/20/14
to adwor...@googlegroups.com
Hi,

Sorry , I gave you Campaign ID for "Dummy".

Please have a look at following Details:

Campaign ID : 187801933

Adgroup ID : 14887069333

Yes, As you explained , Everything is Clear.


           A
          / \
         B   C
            / \
           D   E

i Created Product Partition using " Item_ID "

so my tree like

            A
          / | \
         B  C  D(Other than Products-excluded)

I wanted to know, how to get the Criterion ID of "A";

For your reference, i used this selector here

i am Not getting any 
parentCriterionId WITH VALUE

Thanks



Josh Radcliff (AdWords API Team)

unread,
Jun 23, 2014, 4:36:45 PM6/23/14
to adwor...@googlegroups.com
Hi,

I just tried a request against your account using the following Selector:

         <v20:serviceSelector>
            <v20:fields>Id</v20:fields>
            <v20:fields>ParentCriterionId</v20:fields>
            <v20:predicates>
               <v20:field>AdGroupId</v20:field>
               <v20:operator>EQUALS</v20:operator>
               <v20:values>14887069333</v20:values>
            </v20:predicates>
         </v20:serviceSelector>

and the response included many AdGroupCriterion objects with values for ParentCriterionId. Below are a few examples. The criterion in green corresponds to A in your diagram.

            <totalNumEntries>21</totalNumEntries>
            <Page.Type>AdGroupCriterionPage</Page.Type>
            <entries xsi:type="BiddableAdGroupCriterion" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
               <adGroupId>14887069333</adGroupId>
               <criterionUse>BIDDABLE</criterionUse>
               <criterion xsi:type="ProductPartition">
                  <id>18283950120</id> <!-- The criterion ID of A -->
                  <type>PRODUCT_PARTITION</type>
                  <Criterion.Type>ProductPartition</Criterion.Type>
                  <partitionType>SUBDIVISION</partitionType>
               </criterion>
               <AdGroupCriterion.Type>BiddableAdGroupCriterion</AdGroupCriterion.Type>
            </entries>
            <entries xsi:type="NegativeAdGroupCriterion" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
               <adGroupId>14887069333</adGroupId>
               <criterionUse>NEGATIVE</criterionUse>
               <criterion xsi:type="ProductPartition">
                  <id>51320962143</id>
                  <type>PRODUCT_PARTITION</type>
                  <Criterion.Type>ProductPartition</Criterion.Type>
                  <partitionType>UNIT</partitionType>
                  <parentCriterionId>18283950120</parentCriterionId>
               </criterion>
               <AdGroupCriterion.Type>NegativeAdGroupCriterion</AdGroupCriterion.Type>
            </entries>
            <entries xsi:type="BiddableAdGroupCriterion" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
               <adGroupId>14887069333</adGroupId>
               <criterionUse>BIDDABLE</criterionUse>
               <criterion xsi:type="ProductPartition">
                  <id>77357570773</id>
                  <type>PRODUCT_PARTITION</type>
                  <Criterion.Type>ProductPartition</Criterion.Type>
                  <partitionType>UNIT</partitionType>
                  <parentCriterionId>18283950120</parentCriterionId>
               </criterion>
               <AdGroupCriterion.Type>BiddableAdGroupCriterion</AdGroupCriterion.Type>
            </entries>
            ...

Cheers,
Josh, AdWords API Team

aroxo...@gmail.com

unread,
Jun 24, 2014, 9:49:25 AM6/24/14
to adwor...@googlegroups.com
Hi,

Thanks finally i got it .

Now, We are in Optimization process.

1. Deleting entire Products ( In Product Partition ) at Adgroup  AND inset All Products Again,  We are going to compare the New set of Products

so, Some of Products get REMOVE and Some of New Products will get ADD.

so we can reduce the number of  "operations".

By the way, I can;t get the Product Partition Name 

Below is My Data :

 [1] => BiddableAdGroupCriterion Object
                (
                    [userStatus] => 
                    [systemServingStatus] => 
                    [approvalStatus] => 
                    [disapprovalReasons] => 
                    [destinationUrl] => 
                    [experimentData] => 
                    [firstPageCpc] => 
                    [topOfPageCpc] => 
                    [qualityInfo] => 
                    [biddingStrategyConfiguration] => 
                    [bidModifier] => 
                    [adGroupId] => 14859042493
                    [criterionUse] => BIDDABLE
                    [criterion] => ProductPartition Object
                        (
                            [partitionType] => UNIT
                            [parentCriterionId] => 18283950120
                            [caseValue] => 
                            [id] => 77400162253
                            [type] => PRODUCT_PARTITION
                            [CriterionType] => ProductPartition
                            [_parameterMap:Criterion:private] => Array
                                (
                                    [Criterion.Type] => CriterionType
                                )

                        )

                    [forwardCompatibilityMap] => 
                    [AdGroupCriterionType] => BiddableAdGroupCriterion
                    [_parameterMap:AdGroupCriterion:private] => Array
                        (
                            [AdGroupCriterion.Type] => AdGroupCriterionType
                        )

                )

In that i need Name of ID "77400162253"

i have attached the screenshot of name, Please check it

Thanks

chk.png

Josh Radcliff (AdWords API Team)

unread,
Jun 24, 2014, 4:19:18 PM6/24/14
to
Hi,

I don't follow what you are asking in question #1. Could you rephrase it?

Regarding the product partition name, if you include the field CaseValue in your Selector then you will get back the attributes of the ProductPartition's underlying ProductDimension. In the example you provided, the ProductDimension was a ProductOfferId, so you would be interested in the value attribute highlighted below.

                <entries xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="BiddableAdGroupCriterion">
                    <adGroupId>14859042493</adGroupId>
                    <criterionUse>BIDDABLE</criterionUse>
                    <criterion xsi:type="ProductPartition">
                        <id>77400162253</id>
                        <type>PRODUCT_PARTITION</type>
                        <Criterion.Type>ProductPartition</Criterion.Type>
                        <caseValue xsi:type="ProductOfferId">
                            <ProductDimension.Type>ProductOfferId</ProductDimension.Type>
                            <value>v20151057ti</value>
                        </caseValue>
                    </criterion>
                    <AdGroupCriterion.Type>BiddableAdGroupCriterion</AdGroupCriterion.Type>
                </entries>

For other sub-types of ProductDimension, you would be interested in the attribute that's significant for that sub-type, e.g., for a ProductCanonicalCondition you would want to pull the condition attribute returned. The subtype-specific attributes should be present in the response if you include CaseValue in your Selector fields.

Cheers,
Josh, AdWords API Team

aroxo...@gmail.com

unread,
Jun 25, 2014, 9:38:29 AM6/25/14
to adwor...@googlegroups.com
Hi josh,

Thank you for Your great effort my questions .

Two needs Again:

1. Add Product with Exisitng Product Partition 

createSubdivision(ProductPartition $parent = null,ProductDimension $value = null) ;

[0] => BiddableAdGroupCriterion Object
                (
                    [userStatus] => 
                    [systemServingStatus] => 
                    [approvalStatus] => 
                    [disapprovalReasons] => 
                    [destinationUrl] => 
                    [experimentData] => 
                    [firstPageCpc] => 
                    [topOfPageCpc] => 
                    [qualityInfo] => 
                    [biddingStrategyConfiguration] => 
                    [bidModifier] => 
                    [adGroupId] => 14859042493
                    [criterionUse] => BIDDABLE
                    [criterion] => ProductPartition Object
                        (
                            [partitionType] => SUBDIVISION
                            [parentCriterionId] => 
                            [caseValue] => 
                            [id] => 18283950120
                            [type] => PRODUCT_PARTITION
                            [CriterionType] => ProductPartition
                            [_parameterMap:Criterion:private] => Array
                                (
                                    [Criterion.Type] => CriterionType
                                )

                        )

                    [forwardCompatibilityMap] => 
                    [AdGroupCriterionType] => BiddableAdGroupCriterion
                    [_parameterMap:AdGroupCriterion:private] => Array
                        (
                            [AdGroupCriterion.Type] => AdGroupCriterionType
                        )

                )

i knew , i have to pass the "parentCriterionId"  to " createSubdivision " function,

let me know, what are the parameters i have to pass , ( if i am not get that parameters in above result, let me know )

2. Adding production partition and negative keywords - i done earlier using foreach condition

But some of Adgroups NOT HAVING Products .

is there Any delay sleep have to be added for each Adgroup Request?


Thanks 


Josh Radcliff (AdWords API Team)

unread,
Jun 26, 2014, 5:49:57 PM6/26/14
to adwor...@googlegroups.com
Hi,

1. It looks like you are searching for the arguments you would use with the ProductPartitionHelper in our AddProductPartitionTree example. However, that helper class currently doesn't work particularly well if you already have a partition tree. However, if you are trying to subdivide a product partition that is currently a unit, e.g., change this:

           A
          / \
         B   C

to this:
           A
          / \
         B   C
            / \
           D   E

then you could construct a mutate request with the following operations:
  • REMOVE the current unit for C
  • ADD a subdivision for C with an ID of -1 
  • ADD a unit for D with an ID of -2 and a parentCriterionId of -1
  • ADD a unit for E with an ID of -3 and a parentCriterionId of -1
Again, the ProductPartitionHelper won't be much help here, but you should be able to construct the above AdGroupCriterionOperations relatively easily using the API.

2. Please see the following article in the Help Center on this topic.


Cheers,
Josh, AdWords API Team

aroxo...@gmail.com

unread,
Jun 27, 2014, 3:51:54 AM6/27/14
to adwor...@googlegroups.com
HI,

i am NOT Create " SUB - DIVISION " on Existing Partition, i like to do as follows

This case :

           A
          / \
         B   C

change to  :

               A
          /    |    \
         B   C   D   ( D - Newly added product in the Product partition "A" )  , that is " simply update the product list on existing root partition of Adgroup "

i got the below response :

[0] => BiddableAdGroupCriterion Object
                (
                    [userStatus] => 
                    [systemServingStatus] => 
                    [approvalStatus] => 
                    [disapprovalReasons] => 
                    [destinationUrl] => 
                    [experimentData] => 
                    [firstPageCpc] => 
                    [topOfPageCpc] => 
                    [qualityInfo] => 
                    [biddingStrategyConfiguration] => 
                    [bidModifier] => 
                    [adGroupId] => 14859046693
                    [criterionUse] => BIDDABLE
                    [criterion] => ProductPartition Object
                        (
                            [partitionType] => SUBDIVISION
                            [parentCriterionId] => 
                            [caseValue] => 
                            [id] => 18283950120
                            [type] => PRODUCT_PARTITION
                            [CriterionType] => ProductPartition
                            [_parameterMap:Criterion:private] => Array
                                (
                                    [Criterion.Type] => CriterionType
                                )

                        )

                    [forwardCompatibilityMap] => 
                    [AdGroupCriterionType] => BiddableAdGroupCriterion
                    [_parameterMap:AdGroupCriterion:private] => Array
                        (
                            [AdGroupCriterion.Type] => AdGroupCriterionType
                        )

                )

            [1] => BiddableAdGroupCriterion Object
                (
                    [userStatus] => 
                    [systemServingStatus] => 
                    [approvalStatus] => 
                    [disapprovalReasons] => 
                    [destinationUrl] => 
                    [experimentData] => 
                    [firstPageCpc] => 
                    [topOfPageCpc] => 
                    [qualityInfo] => 
                    [biddingStrategyConfiguration] => 
                    [bidModifier] => 
                    [adGroupId] => 14859046693
                    [criterionUse] => BIDDABLE
                    [criterion] => ProductPartition Object
                        (
                            [partitionType] => UNIT
                            [parentCriterionId] => 18283950120
                            [caseValue] => 
                            [id] => 51320962143
                            [type] => PRODUCT_PARTITION
                            [CriterionType] => ProductPartition
                            [_parameterMap:Criterion:private] => Array
                                (
                                    [Criterion.Type] => CriterionType
                                )

                        )

                    [forwardCompatibilityMap] => 
                    [AdGroupCriterionType] => BiddableAdGroupCriterion
                    [_parameterMap:AdGroupCriterion:private] => Array
                        (
                            [AdGroupCriterion.Type] => AdGroupCriterionType
                        )

                )

--------------------------------

how to add the Product ( update in the existing product partition ) ?

what are the steps like you explained on previous reply,.

Looking forward,

Thanks 


aroxo...@gmail.com

unread,
Jun 30, 2014, 7:05:33 AM6/30/14
to adwor...@googlegroups.com
Hi Josh,

The problem Solved, Really Thanks for your full support and effort

Please make this thread as "Closed".

Thanks
Reply all
Reply to author
Forward
0 new messages