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!
On Tuesday, 22 February 2022 at 14:44:37 UTC+1 Viktor Tereshchenko wrote:
> 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']]);
> }
>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/fcb8c6e2-de9f-41dd-8baa-0cb5ca40ff25n%40googlegroups.com.