How do I query links shared by Facebook Pages? - facebook

I can get a user's page/likes list using the graph /me/likes. But how can I return a list of links shared by these Pages?
For example, let's say a user likes the Facebook Platform Page. I can pull this id (19292868552) using the /me/likes graph api. But how can I pull the links that the Facebook Platform Page has shared on their page?
For a regular user you would do something like this:
Sample FQL:
SELECT link_id, title, summary, url FROM link WHERE owner IN (19292868552);
But for Facebook Pages (like the above Facebook Platform Page example), this returns null. But the actual Facebook Platform Page shows dozens of links (at least). How can I get the links shared by these pages?
You can test it here:
FQL Query Test Console

I'm a little late to the party here, but I thought I'd post my gist example here. fbconsole makes it fairly simple to extract data through the Facebook Graph API to address this issue.
The caveat is that it was not terribly easy to programmatically extract data through fbconsole so I wrote the fbconsole.automatically_authenticate to make it much easier to access this information in a systematic way. This addition has not yet been incorporated into the master branch of fbconsole (it was just posted this morning), but it is available here in the meantime for those that are interested.

Related

Tag persons in Facebook page post

I've written a Facebook web application, which is able to post links to the app page feed (as the page) by requesting the page token and doing a post request to the /PAGE_ID Graph REST endpoint. So far, so good, but I'd like to tag the links with their authors as well. When I add the tags parameter to this request with a value of my user id (I am an admin of the page), this works fine. But when I enter another user id (even one that likes the app page), no tagging is done. Does anyone have any experience with this? Some blog post suggest this is not possible using the Graph API, even though this is possible when done manually.
Thanks!
If I understand correctly what you want to do, it is no longer possible with the new version of the Facebook's API (v.2.0).
Refer to this page for more informations.

Get consolidated facebook comments from plugins via API - as in moderation tool

We have a comments plugin on many of our website pages and would like to be able to retrieve all of the posted comments on the entire site and be able to filter them by the page on which they were posted as the comments are page specific.
All of the comments can be accessed via the url https://developers.facebook.com/tools/comments?id={APP_ID} but I need to be able to access this list via the API.
I realise that we can get the comments when we have the url of the page or the object_id of the plugin. The problem is finding all of the object_ids/urls that we have associated on our site in order to use these comment searching methods.
Other than maintaining a list of all urls that we know have the plugin present, is there any way of dynamically maintaining this list through the api?
All pages have the same associated app_id and are in the same domain.

Get Facebook referral URL in Google Analytics

In my Google Analytics reports I get "facebook.com / referral" as the source. Is it possible to get the exact URL?
I don't think it's possible. as #yahelc pointed on a previous comment most traffic from facebook goes through a facebook controlled redirect on page facebook.com/l.php .So if you want to have campaigns on facebook you can use urls with campaign query parameters to keep track of it.
eg: link to
http://www.example.com/?utm_campaign=Facebook&utm_medium=social&utm_source=facebook.com
Now they will show up in GA as a separate campaign and you can tell how many visitors come from that specific link. You probably want to minify that link using bit.ly or goo.gl.
Create multiple campaigns on facebook and change the utm_campaign parameter as much as you want. You can also create different utm_content parameter to separate your marketing efforts on facebook. Keep the utm_medium and utm_source as static as on the example above.
This is how social marketing analytics measures marketing efforts on social networks. Anything that comes from facebook is not tagged you know comes from people posting links to your site other than you.
At the same time it really makes no sense to have the referral url at all. If you think about it most of the times it will be from private posts that you don't even have access to see, even if you had a url for it. That's just not the way facebook works. It doesn't have pages, it has streams and posts.
More about url tagging:
http://support.google.com/analytics/bin/answer.py?hl=en&answer=1033863
The answer is yes and no. You can drill down to referral path for facebook source in the report Traffic Sources -> Sources -> Refferals by simply pressing facebook.com at the Source coloumn, just like for all other visits from the referring site.
But that would be not much of a use, because for facebook you'll always see /l.php. And that's how facebook works, it doesn't allow visitors to visit the link immedeately, instead it redirects user to the page with url facebook.com/l.php?u=<link-to-your-site.com> with a redirect or maybe with some text like "if you're sure you want to leave", so technically, the referring page would be this /l.php that GA shows.
So if you need to track the efficency of your Facebook activities - use utm tags, like #Eduardo Cereto mentioned. Here's a very nice video tutorial on link tagging for GA: http://services.google.com/analytics/breeze/en/v5/campaigntracking_adwordsintegration-v23_ia5/ (starts from p. 17, you can skip all that goes before).
Hope it helps!
i just know this settings here:
http://www.sebastienpage.com/2009/05/06/google-analytics-trick-see-the-full-referring-url/

Streaming Facebook Pages Wall (not just the pages posts)

I have looked on 100 forums looking for a simple answer for how to stream every post on a Facebook page's wall (not using the like box for just the pages posts, but everyone's posts). I am the admin of the page and I am already using the like box for my posts so I understand that, however the developer pages of Facebook are too confusing for such a simple task. I will be inserting the stream into an HTML page which will be hosted on www.1and1.com so it can handle most, if not all code.
I know it is a lot to ask but is there evem someplace online that will offer plain step-by-step instructions for my specific needs?
If the social plugins they make available aren't sufficient, you could just pull in the feed with the Facebook graph api using the javascript sdk (easiest) or there is probably an SDK for whatever programming language you know. For example, you can see a list of posts on the coca cola page using the Facebook graph explorer:
https://developers.facebook.com/tools/explorer/?method=GET&path=cocacola%2Ffeed
The /page/feed method needs an access token, but you can use the graph explorer to get an offline_access token that you can use to pull the data in. This may eliminate javascript sdk usage though unless you want to first prompt users to authenticate your application. But otherwise you would just parse the json feed that is returned in the url indicated in the graph explorer (and add your access_token to the end of the url).
Here is a good PHP tutorial on how to display a groups feed on a web page. It would be just as easy to display the posts from a page (since you are the admin)
Just replace the group ID with the page ID. Here is a link to the feed for the Facebook Platform feed graph api results. More info on FB Pages here.

How to like a Person using Facebook Social Graph API?

let us start with the known bug from facebook's own dev site:
http://forum.developers.facebook.net/viewtopic.php?id=74700
It appears this is a problem with the IDs of objects other than Posts. Posts
have object IDs of the form USERID_POSTID. When used with the /likes/ URL,
Posts can apparently be liked because their URL conforms to this format.
However, other items, such as status messages, photos, videos, etc. all conform
to the simpler ITEMID object ID. If you add the person who posted the item
(from the from field) to make it of the form USERID_ITEMID, you can also like
and unlike these other types of items.
So let us take http://www.facebook.com/CirqueduSoleil as an example, it has a person ID of 144074117500. For some wierd reason, it is a Person. So, how can I like a Person with the Social graph API.... I am definitely running into the "Whitelist Error" when I try to /144074117500/likes
So how can I "like" anything besides something in the format of userid_postid, in other very simple word: how can I simply like a person using the social graph api?
Firstly, you are not talking about "persons" (users) but facebook pages. And secondly, facebook developers can not create a application that allows to like facebook pages. You can like statuses, comments, pictures, videos, shared links via API (doing POST request on //likes), but not facebook pages. Users can like pages only with the facebook social plugins fb:like (or using the facebook website).
So, why whitelists ? I guess because Facebook can allow some privileged partners to add this feature, but that is not widely open.
You can check some other similar answers for this questions.