nov / fb_graph

This gem doesn't support FB Graph API v2.0+. Please use fb_graph2 gem instead.
MIT License
1.04k stars 191 forks source link

get campaign stats #364

Closed Michael1969 closed 9 years ago

Michael1969 commented 10 years ago

Hi, how I get campaign stats?

app = FbGraph::Application.new(APP_ID, :secret => APP_SECRET)
access_token = app.insights[0].access_token

ad_campaign_stats = FbGraph::AdAccount.new('act_12345', :access_token =>    
"#{access_token}").ad_campaign_stats

ad_campaign_stats.each { |ad_campaign_stat| ad_campaign_stat.inspect }

I get FbGraph::InvalidRequest: GraphMethodException :: Unsupported get request.

Thanks, Michael

pdurkim commented 10 years ago

I'm having an issue with getting stats as well, specifically with the AdGroupStat object. adgroup_stat = FbGraph::AdGroupStat.new('adgroup_id?fields=clicks,impressions') I need more documentation on how to fetch stats

nov commented 10 years ago

Hum, I'm not familiar with Ad APIs. @micahwedemeyer, do you have any idea about FbGraph::InvalidRequest: GraphMethodException :: Unsupported get request?

About @peyterkim's question, probably you should run

FbGraph::AdGroupStat.new('adgroup_id').fetch(fields: [: clicks, : impressions])'