Google Adwords API Issues in “ORDER BY” clause and Average CPC calculations

妖精的绣舞 提交于 2019-12-26 02:39:19

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!