In Google's Click Conversion object documentation, they do not describe the conversionValue parameter very well. They say it must be a numerical value. However, often times with numerical values in programming, there are some issues with numbers being passed that become floats and the precision can sometimes be lost, giving you an unexpected output compared to your input. For instance, in some eCommerce APIs, they want you to overcome this float problem by passing monetary values by multiplying the value by 100. So, let's say I want to pass '0.01' in this field. Is the API flexible enough if I pass it as 0.01 and not in a string? Or if I wrap it as a string like '0.01', will it automatically compute its numerical value with no float precision issue? Or, do I need to treat it like many eCommerce APIs and multiply it by 100 and pass it as (0.01*100) or 1?

I'm using the REST API for posting click conversions to Google Ads. I need to know how to specify the numerical value for conversionValue, and need to know that if I pass it as "0.01" as a double-quoted string in the JSON, if it will work or if it will compute it as zero because it wasn't a numerical value?

Note also that this SO article doesn't really answer because it's talking about the value as a tracking pixel version of posting the conversion to Google, and not a JSON API value used for posting offline conversions. It was interesting to note that this SO poster seemed to have some kind of proof that Google stores this value as a Double, although I don't see any documentation for this. I also don't know how the API treats a string of "0.01" when being passed to this value, and whether it converts it to 0.01 in a Double format in such a way that it won't lose precision on that data.

Tag:google-ads-api

Only one comment.

  1. Volomike

    Peter Laurence from the Google Ads API Team got back to me via email on 7/6/2022 and indicated that the numerical value is a double. One can pass the value as a string or a number with the JSON passed to the REST API and it will store as a double, not a float.

    The only drawback is that something like 10.20 might end up as a 10.2 when stored as a double, but you won't lose at least the cents and no rounding occurs.

Add a new comment.