This project allows you to easily get started with AdWords My Client Center (MCC) cross-account reports using AdWords Scripts and with the full expressive power of the AdWords Query Language (AWQL).
mcc_cross_account_report.js
into the scripts editor.// Store the output here
var SPREADSHEET_URL = 'https://docs.google.com/spreadsheets/d/ABCdefGHIjklMNOpqrSTUvwxYZ/edit';
SELECT
fields, respecting the// AWQL query
var SELECT_VALUES = [
'ExternalCustomerId',
'AccountDescriptiveName',
'Clicks',
'Impressions'
];
var REPORT_QUERY = 'SELECT ' + SELECT_VALUES.join(', ') + ' ' +
'FROM ACCOUNT_PERFORMANCE_REPORT ' +
'WHERE Clicks > 0 ' +
'DURING LAST_30_DAYS';
n
days,n
accordingly:var PURGE_AFTER = 30 /* days */ * (24 * 60 * 60 * 1000) /* in milliseconds */;
After setting up the script according to the guide above, it is time to test it:
If you are happy with the script's output, delete all data in the spreadsheet and schedule the script to run hourly. This is important, as we can only process 50 accounts per run.
If the reports per account take longer than 60 minutes to generate, the script will get interrupted. Simplify your AWQL query in this case.
For all other errors, check the errors section of the AdWords Scripts documentation.
Copyright 2014 Thomas Steiner ([email protected])
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.