Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
160 views
in Technique[技术] by (71.8m points)

php - Google Adwords API Issues in "ORDER BY" clause and Average CPC calculations

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...