ACCOUNT_PERFORMANCE_REPORT gives incorrect cost numbers (does not include Performance Max)

151 views
Skip to first unread message

Viktor Tereshchenko

unread,
Feb 22, 2022, 8:44:37 AM2/22/22
to Google Ads API and AdWords API Forum
We are using a script to pull cost and week data from Google Ads and we think that ACCOUNT_PERFORMANCE_REPORT is responsible for displaying incorrect cost numbers, as it does not include the Performance Max campaigns.

Here's the code and it was working normally before the introduction of Pmaxes.

Can someone please help with it? 
We wonder if the AdWordsApp.report part in the code (as opposed to using the new AdsApp.report) is not causing it, or is it rather Pmax not being supported right now? 

Here's the text version of the script below as well:

function main() {
  var SPREADSHEET_URL = 'X';

  // Name of the specific sheet in the spreadsheet.

  var SHEET_NAME = 'AT';

  var ss = SpreadsheetApp.openByUrl(SPREADSHEET_URL);
  var sheet = ss.getSheetByName(SHEET_NAME);
 
  //Append the row header is sheet is empty
  if (sheet.getLastRow() == 0) {
    sheet.appendRow(['Week from', 'Cost (Mon-Sun)']);
  }
  var report = AdWordsApp.report(
      'SELECT Cost ' +
      'FROM ACCOUNT_PERFORMANCE_REPORT ' +
      'DURING LAST_WEEK');

  var rows = report.rows();
  var timeZone = AdWordsApp.currentAccount().getTimeZone();
  var now = new Date;
  var startDate = new Date(now.getTime() - (7 * 24 * 3600 * 1000));
  var formatedDate = Utilities.formatDate(startDate, timeZone, 'dd/MM/YYYY');
 
  while (rows.hasNext()) {
    var row = rows.next();
    sheet.appendRow([formatedDate,row['Cost']]);
  }
Google Ads weekly cost script.png

Viktor Tereshchenko

unread,
Feb 22, 2022, 8:51:08 AM2/22/22
to Google Ads API and AdWords API Forum
I should mention that we are exporting it to Google Sheets if it makes any difference, although the problem obviously lies in the initial code.

I would appreciate any help, thank you!

Google Ads API Forum Advisor

unread,
Feb 22, 2022, 8:56:49 PM2/22/22
to teresh...@beliani.at, adwor...@googlegroups.com

Hi there,

Thanks for reaching out to the Google Ads API Forum.

Kindly note that Adwords API doesn’t support the Performance Max campaign type. Also, please note that the AdWords API is deprecated and will sunset on April 27, 2022. However, the Performance Max campaign type is supported on Google Ads API. For more information on the Performance Max campaign, you may refer to this document. We strongly recommend that you use Google Ads API to use improved features.

Let us know if you have any further questions.

Regards,

Google Logo
Yasar
Google Ads API Team
 

 

 



ref:_00D1U1174p._5004Q2WxvFb:ref
Reply all
Reply to author
Forward
0 new messages