Copy complete product partition?

34 views
Skip to first unread message

Sophie DecoBloom

unread,
Jun 9, 2016, 8:30:25 PM6/9/16
to AdWords API Forum
Hi,

Say I want to use the ProductPartition structure of an existing shopping Ad group 1 for another Ad group 2 - is there a neasy way to accomplish this, short of a deep re-creation process of the complete partition structure? AdGroupCriterionService complains whenever I use a non-temporary ID, assumedly because the product partition IDs are non-unique?

Peter Oliquino

unread,
Jun 9, 2016, 11:32:09 PM6/9/16
to AdWords API Forum
Hi Sophie,

Temporary ids are used initially when creating a ProductPartition, the API then assigns real ids to replace the temporary ids and reflects them in the response. More details regarding partitioning in this link. Additionally, you can refer to this example in adding/creating ProductPartition trees. You can specify a different adGroupId if you wish to recreate the structure for another adGroup. Examples for other languages could be found here.

I hope this helps and please let us know if you still encounter any issues.

Thanks,
Peter
AdWords API Team

ph...@brainlabsdigital.com

unread,
Aug 24, 2016, 4:29:10 PM8/24/16
to AdWords API Forum
Hi Peter,

I am trying to do a similar thing. Take an existing shopping campaign and duplicate it exactly (different name) within the same account.

I have done the adgroups and campaign creation, but am confused by what I do / do not need to specify when adding the product partition to the ad groups. Please see my method below. I would appreciate it if you were able to shed some light on this.

1) Retrieve all AdGroupCriterion in my adgroup with CriteriaType "PRODUCT_PARTITION", fields downloaded: "AdGroupId", "CpcBid", "CriteriaType", "PartitionType", "CaseValue"
2) Extract the root criterion like so:

    foreach ($partitions as $partition)
    {
      if ($partition->criterion->parentCriterionId == "")
      {
        $adGroupId = $partition->adGroupId;
        $roots[$adGroupId] = $partition;
      }
    }

3) Add the partition to the adgroup:

  $oldPartition = root criterion found above;

  $service  = $user->GetService("AdGroupCriterionService", ADWORDS_VERSION);
  $adGroupCriterion = new BiddableAdGroupCriterion();
  $adGroupCriterion->adGroupId = $adGroup->getId();

  $adGroupCriterion->criterion = $oldPartition->criterion;
  $adGroupCriterion->criterion->id = -1;

  $adGroupCriterion->biddingStrategyConfiguration = 
    $oldPartition->biddingStrategyConfiguration;
  $adGroupCriterion->criterionUse = "BIDDABLE";
  $adGroupCriterion->AdGroupCriterionType = "BiddableAdGroupCriterion";

  $operation = new AdGroupCriterionOperation();
  $operation->operand = $adGroupCriterion;
  $operation->operator = "ADD";

4) When I perform the mutation I get the error: PRODUCT_PARTITION_SUBDIVISION_REQUIRES_OTHERS_CASE

Many thanks,
Phil

Peter Oliquino

unread,
Aug 24, 2016, 11:13:44 PM8/24/16
to AdWords API Forum
Hi Phil,

Thank you for your question. Since this thread is a tad bit old, could you create a new forum thread for your issue? We'll continue our discussion in that thread.

Best regards,
Peter
AdWords API Team
Reply all
Reply to author
Forward
0 new messages