Google Ads Scripts AWQL "CONTAINS_ANY" operator doesn't work

437 Views Asked by At

I'm trying to extract Search queries by certain rules and I need to get Queries that contain one of the given strings:

    " WHERE " +       
       " Impressions > " + IMPRESSIONS_THRESHOLD +
       " AND AverageCpc > " + AVERAGE_CPC_THRESHOLD +
       " AND Query CONTAINS_ANY ['for sale in', 'buy'] " +        
   " DURING YESTERDAY ");

But I'm getting error message (tryed different variations):

One of the conditions in the query is invalid. (file Code.gs, line 19)

Although it seems like I do everything according to Formal Grammar:

String           -> StringSingleQ | StringDoubleQ
StringSingleQ    -> '(char)'
StringDoubleQ    -> "(char)"
StringList       -> [ String (, String)* ]

If I do just 1 string it works fine:

 " WHERE " +       
       " Impressions > " + IMPRESSIONS_THRESHOLD +
       " AND AverageCpc > " + AVERAGE_CPC_THRESHOLD +
       " AND Query CONTAINS 'for sale in' " +
        
   " DURING YESTERDAY ");
1

There are 1 best solutions below

0
On

IIRC, the CONTAINS_ANY operator only works when you are filtering on labels. I'm not sure if this constraint is actually documented, but this article seems to at least imply it.