Change specific bids of Shopping products

305 views
Skip to first unread message

Juan Ramon Sanfeliu Salva

unread,
Nov 27, 2014, 1:37:20 PM11/27/14
to adwords...@googlegroups.com
Hi, do you know if it's possible to update bids of specific shopping products with Adwords Scripts?
 
I know that it's possible to set Maxcpc of product groups using setMaxCpc() from AdWordsApp.ProductGroup, but i didn't found the way to extract the single cpc of a single product by reporting with scripts, and also how to setMaxCpc from a single product, not a shopping adgroup.

I've also tried the using of rootProductGroup() to navigate through the structure of a ProductGroup to obtain specific data from  products as their ItemId and Cpc, but i can extract all products, categories and brands at the same time, just by fetching all shoppingadgroups without selecting campaigns. if i try to arrive to products by choosing a single campaign by using campaigniterator and then shoppingAdgroupIterator, there's no way to go more deeply to product level.

Thanks.

Alexander Wang

unread,
Dec 2, 2014, 7:34:46 PM12/2/14
to adwords...@googlegroups.com
Hi Juan,

I'm not 100% I understand your question. When you say "update bids of specific shopping products", are you referring to "Item ID" product groups? Assuming this is what you want, you can filter for a specific Item ID value like this:
function main() {
 
var productGroups = AdWordsApp.productGroups().withCondition("ProductGroup CONTAINS '123456789'").get();
 
Logger.log(productGroups.totalNumEntities());
 
while (productGroups.hasNext()) {
   
var productGroup = productGroups.next();
   
Logger.log(productGroup.getCampaign().getName() + " : " + productGroup.getAdGroup().getName() + " : " + productGroup.getValue());
   
// adjust productGroup cpc as needed
 
}
}

When I run this in my test account, I get 2 product groups. These 2 product groups are in separate campaigns, are of type Item ID and have value = 123456789. What's happening here is that "ProductGroup" is a field that flattens the node into a single string (e.g. * > Electronics > 123456789) and you can use typical string predicates to filter on this. This is similar to how Product Partition reports work:

You can tweak the code above to adjust cpc as necessary. This condition works at any level too. So you can do shoppingCampaign.productGroups().withCondition("ProductGroup CONTAINS '123'") or shoppingAdGroup.productGroups().withCondition("ProductGroup CONTAINS '123'").

Hope this helps and sorry if I've misunderstood your question.

Cheers,
Alex

Alan Daitch

unread,
Feb 19, 2015, 9:38:16 AM2/19/15
to adwords...@googlegroups.com
Alexander: how are you?

I'm trying to do the same thing as Juan Ramon. Your method works great, but I need to have the product IDs and make a lot of conditionals.

Is there a way to get all the product groups that are "Product ID" type in my account?

thanks!

Alexander Wang

unread,
Feb 19, 2015, 3:10:08 PM2/19/15
to adwords...@googlegroups.com
Hi Alan,

Can you try this?
function main() {
 
var productGroups = AdWordsApp.productGroups().withCondition("ProductGroup CONTAINS 'item id'").get();

 
Logger.log(productGroups.totalNumEntities());
 
while (productGroups.hasNext()) {
   
var productGroup = productGroups.next();

   
if (productGroup.getDimension() == 'ITEM_ID') {

     
Logger.log(productGroup.getCampaign().getName() + " : " + productGroup.getAdGroup().getName() + " : " + productGroup.getValue());
     
// adjust productGroup cpc as needed
   
}
 
}
}

When you navigate to the "Product Groups" tab in one of your ad groups in the AdWords UI, there's a button you can click to download a report. If you download the report and open it, you'll see a column called "Product Group". It'll contain strings like:
* /
and
* / category = "Electronics" / condition = "new" / category = "Audio" / item id = "123456"
The first one is the root node, while the second one is an example of a leaf node you might have in your account.

You can query these strings by using CONTAINS, DOES_NOT_CONTAIN, etc. Depending on how your product groups are set up, simply doing "ProductGroup CONTAINS 'item id'" might be enough. However, the following string also matches:
* / category = "Electronics" / category = "Audio" / item id = "123456" / condition = "new"
(i.e. it will match product groups that have a parent/ancestor product group of type item id)

That's why I added the if statement to filter out product groups that don't have dimension "ITEM_ID". It's not perfect, but it's probably easier to manage then a list of item ids.

Cheers,
Alex

Alan Daitch

unread,
Feb 26, 2015, 12:46:40 PM2/26/15
to adwords...@googlegroups.com
Only one thing: I also had to put as a condition that productGroup.getValue() was different from "OtherCase".

Thanks for your help!
Reply all
Reply to author
Forward
0 new messages