Can't create Product Partition in a Shopping Campaign

93 views
Skip to first unread message

c...@clickbits.de

unread,
Aug 20, 2014, 8:46:59 AM8/20/14
to adwor...@googlegroups.com
Hello,

using the PHP Library v201402 and the Google Adwords API and the Content API for Shopping I want to create shopping campaigns with products from an Google Merchant Center Account.

Via the API I can generate campaigns and adgroups, but I can't create product partions (like productgroups) into the adgroup. Here is my code for the product partition:

$productPartition = new \ProductPartition('UNIT');

$adGroupCriterion
= new \BiddableAdGroupCriterion();
$adGroupCriterion
->criterion = $productPartition;
$adGroupCriterion
->adGroupId = <adgroupId from the last generated adGroup>;

$operation          
= new \AdGroupCriterionOperation();
$operation
->operand  = $adGroupCriterion;
$operation
->operator = 'ADD';
                   
$operations
= array($operation);
$adGroupCriterionService
->mutate($operations);

Is this the right way to generate a product partition? I read the docs a lot of times but i don't know if this is right.

Can anyone help me?


Greetings from Germany

Sérgio Gomes (Shopping API Team)

unread,
Aug 20, 2014, 8:57:51 AM8/20/14
to adwor...@googlegroups.com
Hi there,

I think the issue might be that the tree you're creating is invalid, in that it only has a root node. Take a look at our sample code; it creates a full tree, using some utilities that should make your life a lot easier:


Hope this helps!

Cheers,
Sérgio

---
Sérgio Gomes
Developer Relations

Google UK Limited
Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W 9TQ
Registered in England Number: 3977902
Reply all
Reply to author
Forward
0 new messages