facebook / facebook-ruby-business-sdk

Ruby SDK for Meta Marketing API
https://developers.facebook.com/docs/business-sdk
Other
204 stars 161 forks source link

Not returning conversions from insights endpoints #143

Open adambedford opened 3 years ago

adambedford commented 3 years ago

Which SDK version are you using?

0.10.0.0

What's the issue?

I'm trying to get conversion data from the insights endpoint but no conversion data is ever returned, despite having included conversions in the field list.

This happens at every insight level (account, campaign, ad set, ad).

FWIW I also don't get cost_per_conversion back either.

Steps/Sample code to reproduce the issue

OAuth Scopes: "read_insights,instagram_basic,email,ads_read,ads_management,business_management,attribution_read"

fields = "ctr,impressions,spend,cost_per_conversion,cost_per_action_type,website_purchase_roas,purchase_roas,unique_clicks,cpc,frequency,cpm,conversions"

session = FacebookInterface.session("token")
campaign = FacebookAds::Campaign.get("campaign_id", session)
campaign.insights(fields: fields).all

Observed Results:

[
    [0] {
                          :ctr => "1.827822",
                  :impressions => "283671",
                        :spend => "11178.61",
         :cost_per_action_type => [
            [ 0] {
                :action_type => "omni_purchase",
                      :value => "360.600323"
            },
            [ 1] {
                :action_type => "video_view",
                      :value => "0.284053"
            },
            [ 2] {
                :action_type => "onsite_conversion.post_save",
                      :value => "63.877771"
            },
            [ 3] {
                :action_type => "link_click",
                      :value => "3.272427"
            },
            [ 4] {
                :action_type => "landing_page_view",
                      :value => "4.771067"
            },
            [ 5] {
                :action_type => "post_engagement",
                      :value => "0.257542"
            },
            [ 6] {
                :action_type => "page_engagement",
                      :value => "0.257542"
            },
            [ 7] {
                :action_type => "add_payment_info",
                      :value => "360.600323"
            },
            [ 8] {
                :action_type => "omni_add_to_cart",
                      :value => "151.062297"
            },
            [ 9] {
                :action_type => "omni_initiated_checkout",
                      :value => "103.505648"
            },
            [10] {
                :action_type => "omni_view_content",
                      :value => "14.865173"
            },
            [11] {
                :action_type => "add_to_cart",
                      :value => "151.062297"
            },
            [12] {
                :action_type => "initiate_checkout",
                      :value => "103.505648"
            },
            [13] {
                :action_type => "purchase",
                      :value => "360.600323"
            },
            [14] {
                :action_type => "view_content",
                      :value => "14.865173"
            }
        ],
        :website_purchase_roas => [
            [0] {
                :action_type => "offsite_conversion.fb_pixel_purchase",
                      :value => "0.850903"
            }
        ],
                :purchase_roas => [
            [0] {
                :action_type => "omni_purchase",
                      :value => "0.850903"
            }
        ],
                :unique_clicks => "4265",
                          :cpc => "2.155952",
                    :frequency => "1.45907",
                          :cpm => "39.406954",
                   :date_start => "2021-05-04",
                    :date_stop => "2021-06-02"
    }
]

Expected Results:

I should be getting an array of AdsActionStats for conversions, just as I am for cost_per_action_type

stale[bot] commented 2 years ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

tushark28 commented 9 months ago

same issue.