问题
I am working on my clients MCC account for reporting functionalities.
I am using Google Adwords PHP API version v201309 (latest).
Ok while fetching the resultset with AWQL (Reporting/DownloadCriteriaReportWithAwql.php) i am facing one query error while executing that file.
which is : Type = 'QueryError.INVALID_ORDER_BY_CLAUSE', Trigger = '', FieldPath = ''.
while there is nothing wrong in my query :
$dateRange = sprintf('%d,%d',
date('Ymd', strtotime('1989-01-01')), date('Ymd', strtotime('now')));
'SELECT CampaignId, CampaignName, AverageCpc, Conversions,
Cost, Date FROM CRITERIA_PERFORMANCE_REPORT
WHERE CampaignName
IN ["Local - Search", "Local - Display", "Display New Landing"]
DURING '.$dateRange.' ORDER BY Date';
Another issue i am facing is of Average CPC, there is a different amount in client MCC account and in API response output for particular date. i want to clarify you that i am using AWQL (Reporting/DownloadCriteriaReportWithAwql.php) which creates direct .csv file of output.
Please check screenshots.
- CSV FILE OUTPUT
- Live MCC Account
Thank you for reading my question.
回答1:
The Google Developers page on Reports in AdWords Scripts states that
reports do not support the ORDER BY or LIMIT clauses. Results will be returned in no particular order.
I was outputting to a Google Spreadsheet. My solution was to do make a second sheet that sorted the outputted data by the formula =sort('Account Last Month'!A2:E32;1;true)
回答2:
Try replacing ORDER BY Date
to ORDER BY Date ASC
来源:https://stackoverflow.com/questions/19364223/google-adwords-api-issues-in-order-by-clause-and-average-cpc-calculations