Shopping campaigns. Automatically add new products

126 views
Skip to first unread message

Александр Великий

unread,
May 25, 2017, 10:39:43 AM5/25/17
to AdWords Scripts Forum
Hi,

This question was asked several times before but I'm not sure that the answer is complete.

I have a shopping campaign with one ad group. In this ad groups I have to following structure of product groups:
All procducts
-- Brand 1
-- -- Product ID 1
-- -- Product ID 2
...
-- -- Product ID n
-- Brand 2
-- -- Product ID 1
-- -- Product ID 2
...
-- -- Product ID p
-- Brand 3
...

As new products are added to feed frequently, I'd like the script to automatically add new product id values under brands. So for example, if new product with id 777 and brand "Brand 2" is added to feed, I'd like it to be added like this:

-- Brand 1
-- -- Product ID 1
-- -- Product ID 2
...
-- -- Product ID n
--Brand 2
-- -- Product ID 1
-- -- Product ID 2
...
-- -- Product ID p
-- -- Product ID 777
-- Brand 3
...

What is the simplest way to accomplish this?

Michael Cloonan

unread,
May 26, 2017, 8:14:18 AM5/26/17
to AdWords Scripts Forum
Hello,

It will be a combination of these two code samples:
Regards,
Mike, AdWords Scripts Team

Александр Великий

unread,
May 26, 2017, 11:30:20 AM5/26/17
to AdWords Scripts Forum
Hi, Michael. Thank you for response. Sorry, that I didn't make my question more clear. I know how to add new children to ProductGroup nodes. What I don't know is how to get the ids products that are missing. When you try to edit parent node from adwords interface you can do this with one button click. I'm trying to do similar thing with the script.
2017-05-26 18_28_17-Campaign Management – Google AdWords.png
2017-05-26 18_28_41-Campaign Management – Google AdWords.png

Michael Cloonan

unread,
May 31, 2017, 8:54:16 AM5/31/17
to AdWords Scripts Forum
Hello,

Sorry for the delay in responding. I was talking to a colleague who knows more about shopping specifically to see if he can provide any insights.

I don't think there exists a canonical full list in AdWords scripts that would let you know all product IDs.

There is a sample script for the ShoppingContent API, which you can enable for scripts, that fetches all product IDs which you may want to take a look at using: https://developers.google.com/apps-script/advanced/shopping-content.js

Take a look at this guide for more details on working with advanced APIs (like ShoppingContent): https://developers.google.com/adwords/scripts/docs/features/advanced-apis

You can use a list of product IDs generated from that in conjunction with walking the hierarchy looking for nodes that are missing certain product IDs.

Regards,
Mike, AdWords Scripts Team

Александр Великий

unread,
May 31, 2017, 11:26:22 AM5/31/17
to AdWords Scripts Forum
Thank you, Michael. I've just started to think about same solution. 
I'd like to suggest following feature to add to AdWords Scripts in future versions, that could be useful. 
To be able to get product ids, categories, brands etc. for each ProductGroup object. 
This is what I see in AdWords interface. When I try to edit ProductGroup node, I can see list of all possible child nodes.
Reply all
Reply to author
Forward
0 new messages