New Scripts Label Filter Condition Error

181 views
Skip to first unread message

Itay Meir

unread,
Aug 10, 2022, 6:37:05 AM8/10/22
to Google Ads Scripts Forum
Hello,

We have script that need to filter campaigns by a list of labels.
We are trying to convert the script to the "New Google Ads Scripts Experience", but we are facing an error and we can't find our how to solve it.

The error we are facing is:
InputError: Cannot filter on label because Customer ID is not specified.
at c (adsapp_compiled:3080:21)
at U.ea (adsapp_compiled:3093:23)
at U.withCondition (adsapp_compiled:932:17)
at V.withCondition (adsapp_compiled:3197:14)
at Object.<anonymous> (adsapp_compiled:18605:54)

Any idea what it means and how to fix it?

Thanks in advance,
Itay.
Message has been deleted

Google Ads Scripts Forum Advisor

unread,
Aug 11, 2022, 3:16:03 AM8/11/22
to adwords...@googlegroups.com

Hi Itay,

 

Thank you for reaching out to us. This is Yasmin from the Google Ads Scripts team.

 

Can you please provide the following information as it would help us further investigate?:

  • Google Ads account ID / CID
  • Script name
  • Screenshot of the error
  • Shareable link (guide) of your spreadsheet, if applicable.

 

Regards,

 

Google Logo
Yasmin Gabrielle
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2dJGiw:ref

Itay Meir

unread,
Aug 11, 2022, 4:07:23 AM8/11/22
to Google Ads Scripts Forum
Hi Yasmin,

Thank you for the fast response.
Our Customer ID is: 208-116-3986
The script name is: 010A2 DGT Segment Budget Breach
And a screenshot of the error is attached per your request

The error is happening in line 275, in this section of the line: .withCondition("campaign.labels CONTAINS ANY ('" + filterLabelResources.join("', '") + "')")
You can see line 274 is logging the content of  filterLabelResources and the resource name of the label is correct and has a valid Customer ID in it.

Thanks!
Itay.
Screenshot1.jpg

Google Ads Scripts Forum Advisor

unread,
Aug 11, 2022, 7:46:31 AM8/11/22
to adwords...@googlegroups.com

Hello Itay,

 

This is Maia from the Google Ads Team as well.

 

I can confirm that the resource name of the label is correct and has a valid Customer ID as we were able to retrieve data based on this simple script: (you may also refer to the attached screenshot)

function main() {
  
  var accountSelector =  AdsManagerApp.accounts().withIds(['2650864364']);
  
  var accountIterator = accountSelector.get();
  
  while(accountIterator.hasNext()){
    var account = accountIterator.next();
    AdsManagerApp.select(account);
    console.log("Test: "+account.getName());
    
    var campaignIterator1 = AdsApp.campaigns().withCondition("campaign.status = ENABLED")
                                              .withCondition("campaign.labels CONTAINS ANY ('customers/2650864364/labels/9912922484')").get();
    console.log(campaignIterator1.totalNumEntities());
  }
 
}

 

With this, would you be able to re-execute/run on your end and provide us the latest logs?

 

Best Regards,

Google Logo
Angel Maia
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2dJGiw:ref
testScript.png
Message has been deleted

Itay Meir

unread,
Aug 11, 2022, 1:43:17 PM8/11/22
to Google Ads Scripts Forum
Hi Maia,

Thank you for your time and efforts.
I've implemented your suggestion in our script and it still didn't work.
After that I've tried your complete code in a new blank script and it did work like you said.
So I did some more troubleshooting and it looks like the error didn't actually happen in line 275, but in a different line.
So after I've fixed the problematic line the script now works perfectly.

Thank you very much for you time and help!
Itay.

Google Ads Scripts Forum Advisor

unread,
Aug 12, 2022, 1:07:13 AM8/12/22
to adwords...@googlegroups.com

Hello Itay,

 

I am glad that I was able to help you with your concern. Should you need further assistance or should you encounter errors in your scripts, let us know the issue and rest assured that our team will do their best to assist you.

Reply all
Reply to author
Forward
0 new messages