Campaign Name or labelname in Account performance report

89 views
Skip to first unread message

zaffsy S

unread,
Sep 15, 2020, 7:14:12 PM9/15/20
to Google Ads Scripts Forum
How do I add something like 
'WHERE CampaignName DOES_NOT_CONTAIN_IGNORE_CASE 'nonbrand' '

or 

".withCondition("LabelNames CONTAINS 'nonbrand'")"  

If the above is not possible, can I replace the FROM ACCOUNT_PERFORMANCE_REPORT
below to FROM CAMPAIGN_PERFORMANCE_REPORT and get the same report generated at a campaign level and not account level?

function getReportRowForDuring(during) {
  var report = AdsApp.report(
      'SELECT ' +
          REPORT_FIELDS
              .map(function(field) {
                return field.columnName;
              })
              .join(',') +
          ' FROM ACCOUNT_PERFORMANCE_REPORT ' +
          'DURING ' + during,
      REPORTING_OPTIONS);
  return report.rows().next();
}

Google Ads Scripts Forum Advisor

unread,
Sep 15, 2020, 10:00:25 PM9/15/20
to adwords...@googlegroups.com
Hi,

Thank you for posting your concern.

The Account Performance Report that is implemented in the solution doesn't have CampaignName field so it is not possible to filter it using campaign name. With this, you are correct that the possible workaround that you can do is to change the report type into Campaign Performance Report as CampaignName field is present here.

You may refer to the modified function below and implement it to your current script.
function getReportRowForDuring(during) {
  var report = AdsApp.report(
      'SELECT ' +
          REPORT_FIELDS
              .map(function(field) {
                return field.columnName;
              })
              .join(',') +
          ' FROM CAMPAIGN_PERFORMANCE_REPORT ' +
          ' WHERE CampaignName DOES_NOT_CONTAIN_IGNORE_CASE "nonbrand" ' +
          'DURING ' + during,
      REPORTING_OPTIONS);
  return report.rows().next();
}

Let me know how it goes after trying this suggestion.

Regards,
Google Logo
Ernie John Blanca Tacata
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q24bgPV:ref

zaffsy S

unread,
Sep 16, 2020, 11:04:49 AM9/16/20
to Google Ads Scripts Forum
Thanks Ernie. I tried the above code, and it doesn't seem to work
Here is the error:
TypeError: Cannot call method "getValue" of null (file Code.gs line 365)

I haven't changed anything else from the code. Here is the link to the code:https://developers.google.com/google-ads/scripts/docs/solutions/account-summary

Google Ads Scripts Forum Advisor

unread,
Sep 16, 2020, 4:08:49 PM9/16/20
to adwords...@googlegroups.com
Hi Zaffy,

Can you please privately provide your CID and script name so we can troubleshoot the issue?

Thanks,
Matt

zaffsy S

unread,
Sep 16, 2020, 6:01:54 PM9/16/20
to Google Ads Scripts Forum
The reply to author is grayed out. 
Is there any other way to send it?

zaffsy S

unread,
Sep 17, 2020, 10:32:37 AM9/17/20
to Google Ads Scripts Forum
I sent an email to Google Ads scripts with my CID details.
Any updates on it are really appreciated. Thanks
Reply all
Reply to author
Forward
0 new messages