Storing Dollars and Cents in conversionValue in uploadClickConversions

6 views
Skip to first unread message

Mike M

unread,
Jul 3, 2022, 2:40:35 AMJul 3
to Google Ads API and AdWords API Forum
I'm using the REST API v11 for uploadClickConversions. In building a clickConversion object, the documentation says that the conversionValue must be a numeric value. Sometimes when we do this as programmers, we have to worry about monetary values getting munged when stored in a floating point value -- sometimes what we put in such as 0.01 might get pulled back out as something unexpected and random like 0.013233 or 0, or 0.02, etc. In some eCommerce APIs, companies want developers to multiply the monetary value by 100 and store in raw cents in order to get around this issue.

Can we pass values as a string like "1.55" in the JSON and the uploadClickConversions API will automatically store that as numeric? Or, do we need to pass it literally as its numerical value of 1.55 and hope that the API doesn't munge this due to a floating point versus monetary value issue? Or, do we need to multiply it by 100 and store it as a whole number?


Google Ads API Forum Advisor

unread,
Jul 4, 2022, 3:34:52 AMJul 4
to volo...@gmail.com, adwor...@googlegroups.com

Hi Mike,

Thanks for reaching out to the Google Ads API Forum.

Kindly note that the  value of the conversion for the advertiser to be passed as conversion value is double as seen in below screenshot. Adding float value could result in an error in your API request. So what we recommend is you use double value to upload conversion value for your conversions. You mentioned that sometimes monetary values getting munged when stored in a floating point value, then you may implement to check if value is indeed double and if not, you may implement post processing on your end to parse into double.

 

Regards,

Google Logo
Yasar
Google Ads API Team
 


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