Modifications due to Google Ads script renewal

27 views
Skip to first unread message

shigero-imamura

unread,
Sep 9, 2022, 9:23:22 AM9/9/22
to Google Ads Scripts Forum
Hi.

Keywords are set from Google Ads Script for the created video campaign.

We want to set multiple keywords, so we loop through the newKeywordBuilder as follows to handle this.

//
const videoKeywordBuilder = adGroup.videoTargeting().newKeywordBuilder();
sheetKeywords()
    .getDataRange()
    .getValues()
    .forEach(function (row, index) {
        videoKeywordBuilder
            .withText(row[0].toString())
            .build();
    });
//

In the renewed script, this method only sets the last keyword in the loop.

Please let me know if there is some procedure I am missing or if there is another way to set multiple keywords.

Thanks.

Google Ads Scripts Forum

unread,
Sep 21, 2022, 3:35:44 AM9/21/22
to Google Ads Scripts Forum
Reposting the last inquiry (https://groups.google.com/g/adwords-scripts/c/6IUW6XDuizI) from the forum as it wasn't routed to our support queue.

Regards,
Yasmin
Google Ads Scripts Team
Message has been deleted

Google Ads Scripts Forum Advisor

unread,
Sep 21, 2022, 11:38:17 AM9/21/22
to adwords...@googlegroups.com
Hello,

Can you please clarify if you are creating a new videoKeywordBuilder within a loop? The keyword builder can only perform a single VideoKeywordOperation. 

Please also note that the getValues method returns a 2-dimensional array. We do not have context of the data range from the snippet, but you may be calling forEach on a single element array.

If you are still having issues, can you please privately provide us with your CID and script name so that we can see the full context of the snippet?

Thanks,

Google Logo
Matt
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2edzR8:ref
Reply all
Reply to author
Forward
0 new messages