Posts tagged with google-ads-script

I have followed the syntax from this doc

withCondition("ColumnName IN [Value1, Value2]") 

But I get an error when running this piece of code:

  var adGroups = AdsApp     .adGroups()     .withCondition(agName)     .withCondition(campName)     .get(); 

Error:

5/25/2021 9:32:53 PM    CampaignName CONTAINS_ALL ['test', 'play'] 5/25/2021 9:32:54 PM    Invalid or inapplicable operator is used for field CampaignName. Please check the supported operators. (file Code.gs, line 52) 

I'm not sure what to put in the withCondition to get all such videoAds.

var videoAds = AdsApp                 .videoAds()                 .withCondition('????')                                     .get(); while (videoAds.hasNext()) {     var videoAd = videoAds.next();     data.push([         videoAd.getVideoCampaign().getId(),         videoAd.getVideoCampaign().getName(),         videoAd.getVideoAdGroup().getId(),         videoAd.getVideoAdGroup().getName(),         videoAd.getId(),         videoAd.getName(),     ]); } 

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