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 "); 

Tag:google-ads-api, google-ads-script, awql

Only one comment.

  1. dorian

    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.

Add a new comment.