Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook post impressions are null in FQL stream query

According to the FQL Stream documentation the following query is supposed to return impression counts when run by an authenticated page owner, yet it never does. We have the page owner authenticating directly in the graph api explorer with extended permissions (read_stream, read_insights), but the impression counts are always null.

Is anyone able to get this working?

SELECT post_id, actor_id, message, impressions FROM stream WHERE actor_id = {owned_page} and source_id = {owned_page}
like image 672
Yarin Avatar asked Jul 12 '12 12:07

Yarin


1 Answers

I think its missing in the documentation, but you should make this call using the page access token instead of user access token to get it worked.

So here are the steps:

  1. Get the following permissions from the user and get the user access_token:

    • manage_pages - to get the page access token
    • read_insights - to read the impressions (as mentioned in the doc)
    • read_stream - for all posts that the current session user is able to view

  2. Using that token, get the page access_token with the call-

    /{page-id}?fields=access_token

  3. (optional) Check out my answer here to extend this page access token that will never expire. (Basically to avoid some steps)

  4. Using the page access token, run your query-

    SELECT post_id, actor_id, message, impressions FROM stream WHERE actor_id = {owned_page} and source_id = {owned_page}

    This will fetch you the impressions(if any) in the result.

    enter image description here

Hope that helps.!

like image 127
Sahil Mittal Avatar answered Oct 10 '22 21:10

Sahil Mittal