Bulk creation of Shopping ad groups targeting individual SKUs

647 views
Skip to first unread message

Calin Sandici

unread,
Sep 12, 2014, 2:49:38 PM9/12/14
to adwords...@googlegroups.com
Hello.

A few weeks ago I've migrated many PLA campaigns having a "one ad group / one target SKU" structure to Shopping campaigns, using custom_label_3 as the attribute holding the SKU.

With the newly introduced Shopping Campaigns in scripts I'm now capable to navigate the Shopping campaigns & product groups, but it seems that there is no support, currently, for the custom label attributes.

It seems that with the current version one can create a Shopping ad group, create a root product group (which presumably will have the ad group's Max CPC) and then enable the ad group.

I do not see, however, any possibility to split  the root product group by custom_label_3 and target one SKU alone through scripts (and exclude "everything else" in that ad group).

Am I right? Or is there a way to do it?

Thank you,
Calin

Anash Oommen

unread,
Sep 12, 2014, 3:20:18 PM9/12/14
to adwords...@googlegroups.com
Hi Calin,

You could use something like this:

var customLabel3 = root.newChild().customLabelBuilder().withType("CUSTOM_LABEL_3").build();
Then get the "everything else" child of root as shown here, and call it's exclude() method.

Cheers,
Anash P. Oommen,
AdWords Scripts Team.

Calin Sandici

unread,
Sep 12, 2014, 3:42:09 PM9/12/14
to adwords...@googlegroups.com
Thank you, Anash.

However, I don't see (I must confess I don't understand the above code completely and I did not find the documentation for customLabelBuilder) where I can split the root by the value of the attribute stored in CUSTOM_LABEL_3.

In the end, in each ad group, I have "All products" split by custom_label_3 (only one product qualifies)  = some_value and everything else is excluded. And that product target (the individual product) has its own bid as well.

Calin

Calin Sandici

unread,
Sep 12, 2014, 5:18:17 PM9/12/14
to adwords...@googlegroups.com
It's pretty strange.

var customLabel3 = productGroup.newChild().itemIdBuilder().withValue("test").withBid(0.13).build();

works as expected, it creates a new target (id=test, bid=0.13)

var customLabel3 = productGroup.newChild().customLabelBuilder().withType("CUSTOM_LABEL_3").withValue("test").withBid(0.13).build();

does not work, it throws three errors

Update Partition typeUNITNo change
  • An internal error occurred.

Attempted new value: SUBDIVISION
Add Product partition----
  • Value is required
  • An internal error occurred.
Add Product partition----
  • Value is required
  • An internal error occurred.

Thank you for any pointers,
Calin

Alexander Wang

unread,
Sep 12, 2014, 8:26:01 PM9/12/14
to adwords...@googlegroups.com
That is strange.

Unfortunately, I can't seem to reproduce the error. Using a fresh campaign with one ad group that has just a root product group (aka "All products"), this script runs successfully for me:
function main() {
 
var campaign = AdWordsApp.shoppingCampaigns().withCondition("Name = 'test shopping campaign'").get().next();
 
var ag = campaign.adGroups().get().next();
 
var root = ag.rootProductGroup();
 
var customLabel3 = root.newChild().customLabelBuilder().withType("CUSTOM_LABEL_3").withValue("test").withBid(0.13).build();
}

Can you reply privately with your account id and the name of the script you are trying to run?

Alex

Calin Sandici

unread,
Sep 13, 2014, 3:10:01 AM9/13/14
to adwords...@googlegroups.com
I also moved to another account, created a new Shopping Campaign with only one Ad Group in it.

I added the line

  Logger.log(customLabel3.getErrors());

and it catches this error

[REQUIRED: RequiredError.REQUIRED : criterion.caseValue.type]


though when previewing the script everything seems ok.

Calin Sandici

unread,
Sep 15, 2014, 1:37:44 PM9/15/14
to adwords...@googlegroups.com
I also replied privately to you, Alexander, I forgot to mention, Did you receive the message?

Thank you again,
Calin

Alexander Wang

unread,
Sep 15, 2014, 2:55:44 PM9/15/14
to adwords...@googlegroups.com
I did receive your message. Thanks for all of the info. That should be enough for me to identify the issue. I'll get back to you as soon as I know what's wrong. Apologies for the inconvenience.

Alex

Alexander Wang

unread,
Sep 19, 2014, 2:30:56 PM9/19/14
to adwords...@googlegroups.com
FYI to anyone else who encountered this issue. This was a bug in our system that has since been resolved. Apologies for any inconvenience.

Alex

Mcc Tidart

unread,
Aug 16, 2015, 3:51:56 PM8/16/15
to AdWords Scripts Forum
Is it been solved? I am getting same errors...

Ansicles A

unread,
Aug 18, 2015, 9:13:04 AM8/18/15
to AdWords Scripts Forum
Hi Calin, 

Is it possible to get this script you used to bulk create Shopping Campaigns with each SKU having it's own ad group?

Thanks. 

Calin Sandici

unread,
Aug 18, 2015, 9:21:46 AM8/18/15
to AdWords Scripts Forum
Thank you for the interest, Ansicles.

My script is not quite production-ready and still has less polished parts and customer information in it (nothing I can't filter out, though).
Meanwhile, however, Google released their own script for bulk creation of Shopping ad groups: https://developers.google.com/adwords/scripts/docs/solutions/bulk-shopping-ad-group-creator

Doesn't this fit the bill?

Calin

Ansicles A

unread,
Aug 18, 2015, 11:09:06 AM8/18/15
to AdWords Scripts Forum
Yep...this looks like it would work! 

Thanks Calin. 

Anu A

unread,
Aug 18, 2015, 11:22:43 AM8/18/15
to AdWords Scripts Forum
Hi Calin,

Just something further to this code, no part of the code creates a tracking template for each of the ad gorups . Is there a script that allows me to do this?

Thanks. 

Anu.

Anash Oommen

unread,
Aug 20, 2015, 3:39:59 PM8/20/15
to AdWords Scripts Forum
Hi Anu,

Do you need to set a different tracking template for each ad group, or will the same tracking template suffice?

Cheers,
Anash P. Oommen,
AdWords Scripts Team.

Anu A

unread,
Aug 25, 2015, 4:27:57 AM8/25/15
to AdWords Scripts Forum
Hi Anash,

I need to set different tracking template for each ad group. Is this possible??

Thanks. 

Anu A

unread,
Aug 25, 2015, 4:35:11 AM8/25/15
to AdWords Scripts Forum
Hi Calin, 

Not sure if you could kindly help with this but in regards to the Google Shopping script that ublk creates ad groups/product groups....do you know if there is a way of also creating the tracking template for each of the ad groups?

Thanks. 

On Friday, September 12, 2014 at 7:49:38 PM UTC+1, Calin Sandici wrote:

Calin Sandici

unread,
Aug 25, 2015, 5:24:11 AM8/25/15
to AdWords Scripts Forum
Hello, Anu.

There should be a way, but it involves entering the template in the sheet, reading it from there, passing it as an argument to the createAdGroup function and then using another condition, withTrackingTemplate when building the ad group.

If you can, you should give it a try, it should work. I can't do it myself, as I'm almost on holiday :).

Good luck,
Calin

Anu A

unread,
Aug 25, 2015, 5:42:41 AM8/25/15
to AdWords Scripts Forum
Hi Calin, 

Thanks a lot for the advice. I did try this but i still got an error:
"Cannot find function adGroups in object {lpurl}?CMP=KNC-GNL-FNL-GEN-SHOPPING-SCRIPT-PAN&mckv={_mckv}. (line 529)"

I have added the Tracking template part in the script as below:

 * Creates ad group in AdWords if it doesn't already exist, along with ad group
 * ad.
 */
function createAdGroup(name, status, defaultBid, promotion, campaign, trackingTemplate) {
  // See if ad group exists. If so, fetch it.
  var adGroup = findAdGroupByName(name, campaign);
  if (adGroup != null) {
    if (adGroup.rootProductGroup()) {
      // If root product group exists and not delete, then skip ad group.
      adGroup.skip = true;
    } else {
      adGroup.createRootProductGroup();
    }
    return adGroup;
  }

  // Build ad group.
  var adGroupOp = campaign.newAdGroupBuilder()
        .withName(name)
        .withTrackingTemplate(trackingTemplate)
        .withStatus(status)
        .withMaxCpc(defaultBid)
        .build();


Any ideas? 

Thanks. 

Anu A

unread,
Aug 26, 2015, 12:13:36 PM8/26/15
to AdWords Scripts Forum
Could i please get a respond to this. Been trying to crack this for a few days now and got no reply. Is this possible or not? Have i edited the code properly?

Thanks. 

Anu

Anash Oommen

unread,
Aug 28, 2015, 9:51:03 AM8/28/15
to AdWords Scripts Forum
Hi Anu,

Could you respond using the "Reply to Author" option and share with me the script name and customer ID? I'll take a look at your script.

Cheers,
Anash P. Oommen,
AdWords Scripts Team.

Žygimantas Balsys

unread,
Jan 16, 2019, 5:42:21 AM1/16/19
to Google Ads Scripts Forum
Hi everyone,

I am looking for the advice of clever people. I am using the Bulk Shopping Ad Group Creator from Google. The scripts works perfect. But I am not able to group child items in one parent ad group.

Here is what I am writing in the spredsheet (attached). Custom label 3 is the parent item ID. Which has like 4-5 child items. Do you know is there a way to automatically create ad group with product groups inside one child item per product group? Without filling the spreadsheet with values in every row like:
* / Item ID='1' /
* / Item ID='2' /

I hope this makes sense and you will be able to help me.

Thanks

Screen Shot 2019-01-16 at 12.38.58.png

googleadsscrip...@google.com

unread,
Jan 16, 2019, 3:19:18 PM1/16/19
to Žygimantas Balsys via Google Ads Scripts Forum, Google Ads Scripts Forum
Hi Žygimantas,

Since this is an old thread, can you please create a new one with the issue you are facing?

Regards,
Anthony
Google Ads Scripts Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_scripts
    https://developers.google.com/google-ads/scripts/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

--
-- You received this message because you are subscribed to the Google Groups AdWords Scripts Forum group. Please do not reply to this email. To post to this group or unsubscribe please visit https://developers.google.com/adwords/scripts/community.
---
You received this message because you are subscribed to the Google Groups "Google Ads Scripts Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-scripts+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-scripts/c9197df9-8cc7-46a9-8fe8-8c6c8ad19d81%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages