Understand the values retrieved by the php api of google ads

27 views
Skip to first unread message

Jessica Villa

unread,
Apr 18, 2023, 3:45:24 PM4/18/23
to Google Ads API and AdWords API Forum
Hello!
I hope someone can help me to understand this.

I have this query:

SELECT
campaign.primary_status,
campaign.campaign_group,
metrics.cost_per_conversion,
campaign.name,
segments.date,
metrics.clicks,
metrics.cost_micros
FROM campaign WHERE segments.date DURING LAST_7_DAYS and campaign.id = xxxxxxxxxx

and I get the data successfully but I notice this:

In the field metrics.cost_per_conversion I got in my json response (for example) a number like this:
31334088.24578694

and checking my dashboard, I have: 31.33

Comparison:
31334088.24578694 - 31.33

Why happen this? Do I have to cast my data or something?
I'm using PHP Library.

Thanks!

Google Ads API Forum Advisor

unread,
Apr 19, 2023, 3:39:33 AM4/19/23
to jes...@cleverclick360.com, adwor...@googlegroups.com
Hi Jessica,

Thank you for reaching out to the Google Ads API support team.

Please note that Fields of type Money are returned in micro currency units (micros) in the API which means for example, 1.23 would be converted to 1230000 (multiply by 1000000). To have the same metrics.cost_per_conversion as the console/UI you could simply divide the cost by 1000000.

Link included in this email:
Regards,
Google Logo Google Ads API Team


ref:_00D1U1174p._5004Q2knpQ8:ref
Reply all
Reply to author
Forward
0 new messages