Possible to get "per Page" Tab View counts via Insights API / FQL? - facebook-fql

In the Insights FQL documentation I see the application_tab_views metric listed, but it appears to only show the total Tab impressions over all of the pages the Application is installed on.
The "object_id" in the query is an Application Id, not a Page Id. I don't see a way to add additional "where" conditions to limit it to a specific page. Also, I don't see this metric listed in Pages Insights API.
I am wondering if it's possible to query the number of application tab views on a per-Page basis? Through the regular API or FQL?
In the Page Insights dashboard you can see Facebook is collecting this data (on the "Reach" sub-tab):

My client also wanted these statistics - my solution was to parse the signed_request that the tab receives, the current page_id is in the data and I managed those statistics in my own database. The data is in a parameter called page. From the documentation :
page : A JSON object containing the page id string, the liked boolean if the
user has liked the page, the admin boolean if the user is an admin.
Only available if your app is an iframe loaded in a Page tab.

Related

Website Clicks in Facebook API

Facebook Ad Report tool allows to select from wide selection of columns for displaying. One of them is Website Clicks, which is defined like this:
The number of clicks on links appearing on your ad or Page that direct people to your sites off Facebook as a result of your ad.
How to obtain this column from Facebook API? The official documentation at https://developers.facebook.com/docs/marketing-api/adreportstats/v2.2 doesn't mention this type of column. Is there any workaround?
You'll find them under the action response field if you use the field 'actions_group_by' set to 'action_type'. They will appear as 'link_click'.

Can I show Facebook posts/comments in ecommerce website search results?

Is it possible to use the FB GraphAPI to call posts / comments using specific keywords so that this content can be shown on an e-commerce site search results page?
For example, a user on myhandbags.com searches for 'gucci handbags'. As well as the usual product search results, there is a tab for 'Social posts' - in this tab content from Facebook is shown that matches the search query 'gucci handbags' (so perhaps that phrase is contained in the post/comment).
So the site would need send a GET request to FB when the query is submitted and then fetch the relevant content and display it on the search results page.

Get "Post Count" from public page using Facebook Graph API

I want to get a number of posts from a page in last month. Is is possible with facebook graph API? Also FYI, i just have the access_token to interact with the Facebook API.
Also do anyone knows how to fetch the number of Page mentions in last month?
Thanks for your help in advance.
Try using Facebook's Page Insights using Facebook Graph API's :
https://developers.facebook.com/docs/graph-api/reference/insights/#page_posts
But please note that you need to be a page admin for this page, and you need to acquire a Page Access Token with the permissions 'read_insights'.
If you are not a page admin, then you can also do the same with an User Access Token or an App Access Token.
Steps:
`int postsCount = 0;
Use the following API query https://graph.facebook.com/{page-id}/posts and issue a reuquest.
Count the posts fetched. postsCount = postsCount + {the posts json array size}.
Store the cursor returned by the above API result. Use it to fetch the next page of Posts.
If the {the posts json array size} > 0, then goto step 3.
Notes:
I am sure that you can do it better with FQL, but I am guessing FQL is being deprecated.
I think there is a summary(true) annotation (https://graph.facebook.com/{page-id}?fields=posts.summary(true)) that you can use, but I couldn't get it working.
There is an API rate limit that you need to keep in mind. And do some throttling.
So, the moral of the story is that I am not sure if Facebook really wants you to crawl its Pages if you are not the Admin of the page. :-)

Why does this FQL not return page info?

Why do neither of these two queries return results?
select page_id from page where username="coorslight"
select username from page where page_id=8310601338
If I go point my browser at http://www.facebook.com/coorslight I see their page. I found their page_id (8310601338) by liking them and then querying my likes.
Both of those queries work fine for me in the Graph API Explorer- check you're not forgetting to use an access token for a user who can actually see the page - the page is from an alcohol brand so is probably restricted to users >21 in the US, users >18 in the UK, etc. You must use an access token from a user that meets the restrictions in order to see the page.

Getting Open Graph og:image for page without being a page administrator

I want to use open graph to query the og:image and og:description value for a web page for which I am not an administrator.
I've tried using open graph and fql with both the id of the page and the url, but neither return that information.
I figured that since both values were "public" (they can be viewed in the source of the page) that they would also be public in OpenGraph.
Short of parsing the page myself, is this possible?
I took http://www.southparkstudios.com/ and checked the data returned by the Facebook Object Debugger and varified it had the description and image properties, then I simply clicked the Graph API url of the object (at the bottom of the page, Urls section) and received the site data, and it contained the image and description properties.
Based on that check, if you have the id of the web page then it should give you that info using the graph api, all you need is an active access token, even an application token will probably do the trick.
What did you get when you queried for that data? Did you get an error? just a smaller subset of the data?
Also, can you show the code of how you tried to get that data, both graph api and fql.