Search code examples
ruby-on-railsfacebook-graph-apikoala-gem

Koala Gem get page insights


I am using the Koala gem, and currently trying to get some of the Page insights like impressions etc.. I am presently using the below, which only seems to be returning []

def page_impressions page_id
    @user_graph = Koala::Facebook::API.new(current_user.oauth_token)
    page_token = @user_graph.get_page_access_token(page_id)
    @page_graph = Koala::Facebook::API.new(page_token)
    @page_graph .get_connections(page_id, 'insights', metric: 'page_impressions_frequency_distribution', period: 'week')
  end

Solution

  • Shouldn't you request it like that?

    @page_graph.get_connections(page_id, 'insights/page_impressions_frequency_distribution', period: 'week')