2.2K members online now
2.2K members online now
Dive into advanced features like Remarketing, Flexible Bid Strategies, AdWords Editor, and AdWords Scripts
Guide Me

AWQL: Error in Where statement trying to filter CAMPAIGN_PERFORMANCE_REPORT by Label

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi everyone,

I'm testing how to select some metrics from CAMPAIGN_PERFORMANCE_REPORT filtering by Label. But I'm going crazy with that:
Labels, LabelIds
where Labels CONTAINS "Name of Label"
during LAST_7_DAYS

I've tried the where clause with all of these variants:
where Labels CONTAINS "Name of Label"
where Labels CONTAINS ["Name of Label"]
where Labels CONTAINS 'Name of Label'
where Labels CONTAINS '"Name of Label"'
where Labels CONTAINS '["Name of Label"]'

The same with = and CONTAINS_IGNORE_CASE operators
Furthermore, I've tried in this other way:
where "Name of Label" IN Labels
where ["Name of Label"] IN Labels
where 'Name of Label' IN Labels
where '"Name of Label"' IN Labels
where '["Name of Label"]' IN Labels
But none of these options worked.
On the other hand, I have coded a MCC script where filtered MCC accounts by Label Name in this way: 
var mccLabelText = "Name of Label";
var accountIterator = MccApp.accounts().withCondition("LabelNames CONTAINS '" + mccLabelText +"'").get();

and it worked! 
Any idea about why is not working the campaign label filtering?
Thousands of Thanks!
Marked as Best Answer.
Accepted by topic author Alberto E

AWQL: Error in Where statement trying to filter CAMPAIGN_PERFORMANCE_REPORT by Label

Visitor ✭ ✭ ✭
# 2
Visitor ✭ ✭ ✭

I've got the answer from AdWords Script Team!



Hi Alberto,

Unfortunately, filtering by Labels using CONTAINS in report is not possible. The only supported operators for Labels are: CONTAINS_ALLCONTAINS_ANY, and CONTAINS_NONE since it is a field with type of List.
Also, using CONTAINS for LabelNames are only acceptable in ManagedAccountSelector. For other selectors (e.g. campaignSelectoradSelector), here are the operators that can be used for StringSet columns (e.g. LabelNames): CONTAINS_ALLCONTAINS_ANYCONTAINS_NONE.
Paul Justine De Honor
AdWords Scripts Team