Open afn opened 1 year ago
18.0.2
The AdInsights object doesn't have fields for breakdowns
spend_stats = FacebookAds::AdAccount .get(ad_account_id, session) .insights( time_range: { since: date.to_s(:db), until: date.to_s(:db) }, breakdowns: ['hourly_stats_aggregated_by_advertiser_time_zone'], fields: %w[impressions clicks spend ad_id adset_id campaign_id], level: 'ad', ) .all spend_stats[0].impressions # => "1234" spend_stats[0].ad_id # => "some-ad-id" spend_stats[0].hourly_stats_aggregated_by_advertiser_time_zone # NoMethodError: undefined method `hourly_stats_aggregated_by_advertiser_time_zone' for #<FacebookAds::AdsInsights {:impressions=>"1234", :clicks=>"x", :spend=>"x", :ad_id=>"some-ad-id", :adset_id=>"some-adset-id", :campaign_id=>"some-campaign-id", :date_start=>"2023-10-18", :date_stop=>"2023-10-18", :hourly_stats_aggregated_by_advertiser_time_zone=>"06:00:00 - 06:59:59"}> spend_stats[0][:hourly_stats_aggregated_by_advertiser_time_zone] # => "06:00:00 - 06:59:59"
Calling hourly_stats_aggregated_by_advertiser_time_zone on the AdInsights object raises a NoMethodError
hourly_stats_aggregated_by_advertiser_time_zone
Calling hourly_stats_aggregated_by_advertiser_time_zone on the AdInsights object returns the value of the field
Which SDK version are you using?
18.0.2
What's the issue?
The AdInsights object doesn't have fields for breakdowns
Steps/Sample code to reproduce the issue
Observed Results:
Calling
hourly_stats_aggregated_by_advertiser_time_zone
on the AdInsights object raises a NoMethodErrorExpected Results:
Calling
hourly_stats_aggregated_by_advertiser_time_zone
on the AdInsights object returns the value of the field