Convert micros to currency in AWQL csv report with Adwords API

437 views
Skip to first unread message

Mario Young

unread,
Sep 13, 2014, 12:33:04 AM9/13/14
to adwor...@googlegroups.com

I have this query in AWQL and I get the response in CSV format using theReportUtils::DownloadReportWithAwql 

select Date, Clicks, Cost from ACCOUNT_PERFORMANCE_REPORT during LAST_30_DAYS

I need to convert the Cost data in the CSV from micros to the currency in the account (Cost / 1000000).

Also I need to be able to convert any the Cost data in the response using any AWQL query, for example the solution has to work for this query also:

SELECT CampaignName, KeywordText, Cost, CostPerConversion, QualityScore FROM KEYWORDS_PERFORMANCE_REPORT DURING LAST_7_DAYS

As of v201406, the returnMoneyInMicros header is no longer valid and values are always returned as micros.https://developers.google.com/adwords/api/docs/guides/reporting-concepts#money

 I make the 2 query and the result are here now imagine you have cost1 in a $variable1 and cost2 in $variable2. how do I divide by 1000000 the Cost and Cost/conversion columns in the variables using the same function? in PHP

Ray Tsang (AdWords API Team)

unread,
Sep 15, 2014, 12:55:41 PM9/15/14
to adwor...@googlegroups.com
Mario,

You'll have to parse and process the data, and perform the calculation accordingly.

Thanks,

Ray
Reply all
Reply to author
Forward
0 new messages