Hi,

You may refer to this section
<https://developers.google.com/adwords/api/docs/guides/shopping#partitioning> of
our shopping campaigns
<https://developers.google.com/adwords/api/docs/guides/shopping> guide and
also to this example code
<https://developers.google.com/adwords/api/docs/samples/php/shopping-campaigns#build-a-product-partition-tree-for-an-ad-group> (PHP)
on how to create subdivision using ProductBrand
<https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupCriterionService.ProductBrand>.
I hope this helps.

Thanks and regards,
Peter
Google Ads API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    https://ads-developers.googleblog.com/search/label/google_ads_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

On 04/09/19 22:29:54 [email protected] wrote:

Hi. I'm struggeling with making a subdivision to a brand. Can you provide
full example of you code? It seems you found a solution to what I'm trying
to do.

mandag den 4. marts 2019 kl. 12.18.32 UTC+1 skrev [email protected]:

thanks for the support, I tried your solution of setting the ID but I was
getting issues because of *new ProductPartition(); *I was creating the
partition using *$root = ProductPartitions::createSubdivision(); *so having *use
Google\AdsApi\AdWords\v201806\cm\ProductPartition; *caused conflicts.

I got around this by reading the response *e.g *$all_ids =
ProductPartitions::showAdGroupTree($adWordsServices,$session,$adGroupId);

I then did explode to get the ID of the partition I needed.

I had another issue as *ProductPartitions::createUnit *only allows for an
object to be passed not a partition ID so I created an almost identical
function which could read the ID not Object.

I now have 2 functions in my API code (ProductPartitions.php) for Creating
Units.


    public static function createUnit(
        ProductPartition $parent = null,
        ProductDimension $value = null
    ) {
        $unit = new ProductPartition();
        $unit->setPartitionType(ProductPartitionType::UNIT);

        // The root node has neither a parent nor a value
        if ($parent !== null) {
            $unit->setParentCriterionId($parent->getId());
            $unit->setCaseValue($value);
        }

        return $unit;
    }
    public static function createUnit2($parent,$value) {
        $unit = new ProductPartition();
        $unit->setPartitionType(ProductPartitionType::UNIT);

        // The root node has neither a parent nor a value
            $unit->setParentCriterionId($parent);
            $unit->setCaseValue($value);

        return $unit;
    }





On Friday, 1 March 2019 19:34:41 UTC, [email protected] wrote:

Hi,

I am currently trying to update our Shopping campaign through the Google
Ad's API and so far so good.

I have a bit of an issue when hitting over 5000 requests. I am aware that
there is a 5000 limit per request and I'm not too far off we have 5,600ish
products in the shopping that I want on the Ad Campaign.


Problem is I create the Ad Group and Partitions at the top of my script
with this code:


                        $operations = [];
$root = *ProductPartitions::createSubdivision(); ///This is what I think is
causing the problem,*
$criterion = ProductPartitions::asBiddableAdGroupCriterion($adGroupId,
$root);
$operation = ProductPartitions::createAddOperation($criterion);
$operations[] = $operation;
$otherCondition = ProductPartitions::createSubdivision(
$root,
new ProductCanonicalCondition()
);
$criterion = ProductPartitions::asBiddableAdGroupCriterion(
$adGroupId,
$otherCondition
);
$operation = ProductPartitions::createAddOperation($criterion);
$operations[] = $operation;

$otherBrand = ProductPartitions::createSubdivision(
$otherCondition,
new ProductOfferId()
);
$criterion = ProductPartitions::asBiddableAdGroupCriterion(
$adGroupId,
$otherBrand
);
$operation = ProductPartitions::createAddOperation($criterion);
$operations[] = $operation;
$productBiddingCategory = new ProductBiddingCategory();
$productBiddingCategory->setType(ProductDimensionType::BIDDING_CATEGORY_L1);
$productBiddingCategoryUnit = ProductPartitions::createUnit($otherBrand,
$productBiddingCategory);
$criterion = ProductPartitions::asBiddableAdGroupCriterion(
$adGroupId,
$productBiddingCategoryUnit,
10000
);
$operation = ProductPartitions::createAddOperation($criterion);
$operations[] = $operation;



After I send the first 5000 operations I try to do another loop to send
another 1400ish, the problem is where I run this code


                        $cheapBrand = new ProductOfferId();
$cheapBrand->setValue($sku);
$cheapBrandUnit = ProductPartitions::createUnit(*$root*, $cheapBrand); *///Where
this line says $root I think it's trying to re-create $root rather than get
the previously created.*
$criterion = ProductPartitions::asBiddableAdGroupCriterion(
$adGroupId,
$cheapBrandUnit,
        $bid_trans
);
        $operation = ProductPartitions::createAddOperation($criterion);
$operations[] = $operation;


It seems because I don't store the $root object the code tries to re-create
and then fails with error:


 AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @
operations[1].operand.criterion.parentCriterionId;


I can't delete and rebuild the Root partition as I just want to add to the
existing 5000 request so in total there are 2 requests to build the
partitions.



--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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].
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/d5bb97f5-47f3-4803-a52d-f6f897f033cd%40googlegroups.com
<https://groups.google.com/d/msgid/adwords-api/d5bb97f5-47f3-4803-a52d-f6f897f033cd%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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].
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/18i4930000000000gem8940020idhaz64mjecpo74o30c1g68qjee1o%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
  • How To ... ryant
    • RE... googleadsapi-forumadvisor via AdWords API and Google Ads API Forum
    • Re... ryant
      • ... googleadsapi-forumadvisor via AdWords API and Google Ads API Forum
      • ... Hans Henrik Søllested
        • ... googleadsapi-forumadvisor via AdWords API and Google Ads API Forum

Reply via email to