AWQL: doesn't work Labels CONTAINS_NONE

82 views
Skip to first unread message

styu

unread,
Apr 15, 2019, 1:32:16 PM4/15/19
to Google Ads Scripts Forum
Hi everyone,

I'm trying take all campaigns that don't have label "exclude" from CAMPAIGN_PERFORMANCE_REPORT. But All time have the same error: "Failed to read from AdWords. Please wait a bit and try again.

"SELECT CampaignId, AccountDescriptiveName, CampaignName, RecommendedBudgetAmount, CampaignStatus, SearchBudgetLostImpressionShare, Amount, Cost, AdvertisingChannelType, CostPerConversion, Conversions, Labels
FROM CAMPAIGN_PERFORMANCE_REPORT
WHERE SearchBudgetLostImpressionShare > '0' AND Cost > '1' AND AdvertisingChannelType = 'SEARCH' AND CampaignStatus = 'ENABLED' AND Labels CONTAINS_NONE [exclude]
DURING LAST_30_DAYS"

Tried all variations:
Labels CONTAINS_NONE ['exclude'] - failed to read
Labels CONTAINS_NONE [\"exclude\"] - condition is invalid
Labels CONTAINS_NONE [exclude] - failed to read
Labels CONTAINS_NONE 'exclude' - condition is invalid

Without label condition everything worked perfect.

Could someone explain, what is wrong? 

Thousand of Thanks! 
Message has been deleted

googleadsscrip...@google.com

unread,
Apr 15, 2019, 3:18:28 PM4/15/19
to styu via Google Ads Scripts Forum, Google Ads Scripts Forum
Hello,

Though the documentation specifies a list of label names for the Labels attribute, it appears that it is expecting a label ID. As a workaround, you can get the label ID, by name, with the following code:

  var label = AdsApp.labels().withCondition("Name = 'exclude'").get().next();
  
var labelId = label.getId();

Then you can reference the label ID in the WHERE statement:

 "WHERE  Labels CONTAINS_NONE ['" + labelId + "'] " //Include other conditions in your WHERE statement as well

Regards,
Matt
Google Ads Scripts Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    https://ads-developers.googleblog.com/search/label/google_ads_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/0666a357-4caf-4602-a670-94a68073998e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages