Why cost exported from Adwords API is not correct (too many weird zeros in the end and no separator for decimals)

712 views
Skip to first unread message

Rui Song

unread,
Sep 12, 2017, 3:32:17 PM9/12/17
to AdWords API Forum
Hi, I have been using Adwords API with Python to fetch some numbers, all the metrics are correct (impressions & clicks) except for the costs. The costs always end with 4 zeros and no separator for decimals. 

Below is the result I got (last column is the real cost I pulled from Adwords interface as reference):














Below I attached the python code I was using, would be great if you could take a look and give me some advice: 

Thanks!!!

import sys
from googleads import adwords


def main(client):
# Initialize appropriate service.
report_downloader = client.GetReportDownloader(version='v201708')

# Create report query.
report_query = ('SELECT CampaignId, AdGroupId, Id, Criteria, CriteriaType, '
'FinalUrls, Impressions, Clicks, Cost '
'FROM CRITERIA_PERFORMANCE_REPORT '
'WHERE Status IN [ENABLED] '
'DURING LAST_7_DAYS')

# You can provide a file object to write the output to. For this
# demonstration we use sys.stdout to write the report to the screen.
report_downloader.DownloadReportWithAwql(
report_query, 'CSV', sys.stdout, skip_report_header=False,
skip_column_header=False, skip_report_summary=False,
include_zero_impressions=True)


if __name__ == '__main__':
# Initialize client object.
adwords_client = adwords.AdWordsClient.LoadFromStorage()

main(adwords_client)

Shwetha Vastrad (AdWords API Team)

unread,
Sep 12, 2017, 3:57:01 PM9/12/17
to AdWords API Forum
Hi,

In AdWords API, fields of type Money are returned in micro currency units(micros). You need to divide the value by 1000000 to get the Cost in the account's local currency. 

Regards,
Shwetha, AdWords API Team.
Reply all
Reply to author
Forward
0 new messages