How to create the Product groups (Product Partition) using PHP client library of google ad words API

333 views
Skip to first unread message

Akbar Ali

unread,
Apr 1, 2019, 5:03:12 PM4/1/19
to AdWords API and Google Ads API Forum
I am working with Google AdWords API to create ad groups and product groups (Product partitions) using the PHP client library provided by Google team. I have successfully created the ad groups using that library. But I am stuck at the point to create product groups for that ad group.

 I have tried to create products partitions for that shopping campaign using the script "AddProductPartitionTree.php" provided in the client library. But every time it throws an error
[AdGroupCriterionError.PRODUCT_PARTITION_ALREADY_EXISTS @ operations[8].

Will you please update about it.

googleadsapi...@google.com

unread,
Apr 1, 2019, 11:44:28 PM4/1/19
to adwor...@googlegroups.com, AdWords API and Google Ads API Forum
Hi Akbar, 

Based on the error message that you provided, it looks like the subdivision creation is failing as there is an existing product partition already. You may try to get the criterion that you just added by using the get method of AdGroupCriterionService to check if this is indeed existing.

To further investigate the issue, kindly provide the complete SOAP request and response logs together with the customer ID and the error message via Reply privately to author.

Thanks,
Ejay
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/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscribe@googlegroups.com
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 adwords-api+unsubscribe@googlegroups.com.
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/92950152-b25b-4f25-a6aa-c639ea4f2a4a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Denis B

unread,
May 19, 2020, 6:14:23 AM5/19/20
to AdWords API and Google Ads API Forum
This is the working php code for creating new product partition group.

$root = new ProductPartition();
$root
->setPartitionType(ProductPartitionType::SUBDIVISION);
$root
->setId(18283950120); // this is id of parent product group. you can get this id with PRODUCT_PARTITION_REPORT, from fields "id" (criterion id) and parent_id (parent criterion id)
//
$offerId
= new ProductOfferId(); // это productDimension
$offerId
->setValue($product_id); // this is inner product id from your merchant feed for which you want to create new partition group
$newUnit
= ProductPartitions::createUnit($root, $offerId);
$criterion
= ProductPartitions::asBiddableAdGroupCriterion(
 
22622716325, // your merchant adgroup_id
  $newUnit
,
 
4*1000000 // bid for new partition group
);
$operation
= ProductPartitions::createAddOperation($criterion);
$operations
[] = $operation;
//
$adWordsServices
= new AdWordsServices();
$session
= $this->getSession();
$adGroupCriterionService
= $adWordsServices->get($session, AdGroupCriterionService::class);
$adGroupCriterionService
->mutate($operations);


вторник, 2 апреля 2019 г., 0:03:12 UTC+3 пользователь Akbar Ali написал:
Reply all
Reply to author
Forward
0 new messages