Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breakdown fields are missing on AdsInsights #203

Open
afn opened this issue Oct 19, 2023 · 0 comments
Open

Breakdown fields are missing on AdsInsights #203

afn opened this issue Oct 19, 2023 · 0 comments

Comments

@afn
Copy link

afn commented Oct 19, 2023

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

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"

Observed Results:

Calling hourly_stats_aggregated_by_advertiser_time_zone on the AdInsights object raises a NoMethodError

Expected Results:

Calling hourly_stats_aggregated_by_advertiser_time_zone on the AdInsights object returns the value of the field

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant