Google Adwords API Issues in “ORDER BY” clause and

2019-09-20 15:20发布

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

enter image description here

  • Live MCC Account

enter image description here

Thank you for reading my question.

2条回答
We Are One
2楼-- · 2019-09-20 15:41

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)

查看更多
Anthone
3楼-- · 2019-09-20 15:56

Try replacing ORDER BY Date to ORDER BY Date ASC

查看更多
登录 后发表回答