How to write a query for Facebook insights in Rails with Koala gem?

754 views Asked by At

I tried without success to write some query in Rails with Koala gem to get data form Facebook Insights for pages.

Can someone help me to write query for URL like this: https://graph.facebook.com/[Page-ID]/insights/page_fans

I tried:

 @graph.get_object("[Page-ID]/insights/page_fans")
1

There are 1 answers

0
joseramonc On

With this you get page_impressions. You can see a list of complete parameters for metric here https://developers.facebook.com/docs/graph-api/reference/v2.0/insights

page_graph = Koala::Facebook::API.new(access_key) impressions = page_graph.get_connections('me', 'insights', metric: 'page_impressions', period: 'now')