API Bug - invalid value for Float(): "NaN"?

103 views
Skip to first unread message

David Haslem

unread,
Dec 14, 2015, 3:31:05 PM12/14/15
to AdWords API Forum
I'm getting an error trying to pull conversion trackers for an account (the id is 6800061575). The soap request we send is a Get for ConversionTrackers:

{:fields=>["AlwaysUseDefaultRevenueValue", "AppId", "AppPlatform", "AppPostbackUrl", "BackgroundColor", "Category", "ConversionPageLanguage", "ConversionValue", "CountingType", "DefaultRevenueCurrencyCode", "DefaultRevenueValue", "ExcludeFromBidding", "Id
", "IsProductAdsChargeable", "MarkupLanguage", "Name", "NumConversionEvents", "NumConvertedClicks", "ProductAdsChargeableConversionWindow", "Status", "TextFormat", "TrackingCodeType", "ViewthroughLookbackWindow"], :predicates=>[{:field=>"Status", :operato
r=>"IN", :values=>["ENABLED", "DISABLED", "HIDDEN"]}], :paging=>{:start_index=>0, :number_results=>500}}

The error appears to be from a bad value "NaN" returned for one of the conversion trackers, returned directly by the API, which the rubygem then throws an exception on:

ArgumentError: invalid value for Float(): "NaN"
    [  0] "/app/vendor/bundle/ruby/2.1.0/gems/google-ads-common-0.9.9/lib/ads_common/results_extractor.rb:235:in `Float'",
    [  1] "/app/vendor/bundle/ruby/2.1.0/gems/google-ads-common-0.9.9/lib/ads_common/results_extractor.rb:235:in `normalize_item'",
    [  2] "/app/vendor/bundle/ruby/2.1.0/gems/google-ads-common-0.9.9/lib/ads_common/results_extractor.rb:98:in `normalize_output_field'",
    [  3] "/app/vendor/bundle/ruby/2.1.0/gems/google-ads-common-0.9.9/lib/ads_common/results_extractor.rb:77:in `block in normalize_fields'",
    [  4] "/app/vendor/bundle/ruby/2.1.0/gems/google-ads-common-0.9.9/lib/ads_common/results_extractor.rb:73:in `each'",
    [  5] "/app/vendor/bundle/ruby/2.1.0/gems/google-ads-common-0.9.9/lib/ads_common/results_extractor.rb:73:in `normalize_fields'",
    [  6] "/app/vendor/bundle/ruby/2.1.0/gems/google-ads-common-0.9.9/lib/ads_common/results_extractor.rb:128:in `normalize_hash_field'",
    [  7] "/app/vendor/bundle/ruby/2.1.0/gems/google-ads-common-0.9.9/lib/ads_common/results_extractor.rb:96:in `normalize_output_field'",
    [  8] "/app/vendor/bundle/ruby/2.1.0/gems/google-ads-common-0.9.9/lib/ads_common/results_extractor.rb:112:in `block in normalize_array_field'",
    [  9] "/app/vendor/bundle/ruby/2.1.0/gems/google-ads-common-0.9.9/lib/ads_common/results_extractor.rb:112:in `map'",
    [ 10] "/app/vendor/bundle/ruby/2.1.0/gems/google-ads-common-0.9.9/lib/ads_common/results_extractor.rb:112:in `normalize_array_field'",
    [ 11] "/app/vendor/bundle/ruby/2.1.0/gems/google-ads-common-0.9.9/lib/ads_common/results_extractor.rb:94:in `normalize_output_field'",
    [ 12] "/app/vendor/bundle/ruby/2.1.0/gems/google-ads-common-0.9.9/lib/ads_common/results_extractor.rb:77:in `block in normalize_fields'",

Michael Cloonan (AdWords API Team)

unread,
Dec 14, 2015, 3:45:29 PM12/14/15
to AdWords API Forum
Hello,

The library should handle this more gracefully. Please file a bug in the issue tracker for the Ruby library.

Regards,
Mike, AdWords API Team

David Haslem

unread,
Dec 14, 2015, 4:12:39 PM12/14/15
to AdWords API Forum
Just to be clear for when I'm logging the issue there - NaN is considered a valid float return value for the "defaultRevenueValue" attribute on the conversion tracker type? That's what I'm seeing when I enable verbose logging to dump the raw XML from within the gem:

<entries xmlns:xsi="http://www.w3.org/2001/XMLS
chema-instance" xsi:type="AdWordsConversionTracker"><id>180679886</id><name>wertwertw</name><status>ENABLED</status><category>DEFAULT</category><viewthroughLookbackWindow>30</viewthroughLookbackWindow><isProductAdsChargeable>false</isProductAdsChargeable>
<productAdsChargeableConversionWindow>30</productAdsChargeableConversionWindow><ctcLookbackWindow>30</ctcLookbackWindow><countingType>MANY_PER_CLICK</countingType><defaultRevenueValue>NaN</defaultRevenueValue>...

Michael Cloonan (AdWords API Team)

unread,
Dec 15, 2015, 8:57:20 AM12/15/15
to AdWords API Forum
Hello,

I'm not sure; it does seem suspect. I will follow up with the engineering team to see if this is valid.

Whether it's valid or not, the Ruby library should still give you the results it gets back as much as possible, which is why I wanted you to file that other bug (thank you for doing that).

In this thread, let's track whether or not NaN should be a valid return value. I'll let you know when I hear back from the team.

Regards,
Mike, AdWords API Team

Michael Cloonan (AdWords API Team)

unread,
Sep 13, 2016, 8:36:37 AM9/13/16
to AdWords API Forum
Hello,

The engineering team has implemented a fix that should prevent NaN values in this case. Please let me know if you're still having difficulties.

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