How to obtain this Facebook user id for the like button? - facebook

Referring to the Open Graph protocol, I must implement this strange tag to my website in order to add a like-button for it.
<meta property="fb:admins" content="USER_ID"/>
USER_ID is supposed to be replaced by my actual user ID at Facebook. How do I safely obtain the correct user ID?

This user id can be found a few ways:
1) Go to http://graph.facebook.com/you_user_name and you will see JSON data with the id property.
2) Or go to your profile page and you will see a url like this http://www.facebook.com/profile.php?id=12345656. The number after id= is your user id.

You can get a Facebook ID by doing this:
http://www.ehow.com/how_5753004_facebook-id.html
Basically, go to your photos and click on one. It will be in the URL bar under fbid.

If you log onto facebook you will see uid=USER_ID in the URL for home, profile etc.

Related

Linking to a page tab app on a Facebook page

Is there a reliable way to link to an app on a Facebook page, when only the page ID and app ID are known? Specifically the URL to the page is not known, only the ID.
The documentation at https://developers.facebook.com/docs/authentication/pagetab/ claims that the following should work:
https://www.facebook.com/pages/null/PAGE_ID/app_YOUR_APP_ID
However when I try this, for example http://www.facebook.com/pages/null/126169047465269/app_222972467721305 does not work and instead I get "This content is currently unavailable".
The best form that will always work for a numeric page ID is this:
https://www.facebook.com/pages/null/PAGEID?sk=app_APPID
Replace PAGEID and APPID with numeric IDs.
If instead of a numeric page ID you have a username, then the URL should be of this form:
https://www.facebook.com/PAGEUSERNAME?sk=app_APPID
or
https://www.facebook.com/PAGEUSERNAME/app_APPID
The Page here is not Public or maybe is not available?:
https://www.facebook.com/pages/126169047465269/
Try this,
https://www.facebook.com/PAGE_NAME_OR_ID/app_222972467721305
In the PAGE_NAME_OR_ID add pages/126169047465269,
if your page have a custom slug add the slug.
But to be sure check if your app is in a Sandbox mode or Unpublished.

How do I generate Facebook like button with only the FB page ID

So I have a database table with the Facebook page ID's of my users. I would like to generate a like button dynamically with only the ID available to me to do this. The problem as I see it is that I don't know what the data-href attribute is supposed to have considering that Facebook page url's look like this: http://facebook.com/pages/hyphenated-name/<?=$FB_id?> and I don't have the hyphenated name stored in my database to generate the that url.
Is there another URL structure Facebook's back-end will accept that just has the ID and not the hyphenated name, but will still count likes on that person's Facebook fan page? Is this impossible?
You can do a look up of the id, and retrieve the link of the page stored.
example: https://developers.facebook.com/tools/explorer?method=GET&path=191825050853209
refer to: https://developers.facebook.com/docs/reference/api/page/ under link connection.
This method will require use of the graph api, or one of the sdks.
refer to: https://developers.facebook.com/docs/reference/api

Does the url I provide for Facebook Like Button need to be exact or can it be one that redirects?

So I'm trying to generate the right URL to go in the facebook Like button. The URL is to a person's facebook page and it's generated using their facebook page's ID.
The facebook like button developers page says that I need to include this URL in the data-href="" attribute in the <div> they provide (that the iframe is generated in).
When I go to a URL like http://www.facebook.com/234h23o4ub23 it redirects to the right place. So I'm wondering if I can get away with using this shorter url as opposed to the url that it redirects to like for example: http://www.facebook.com/pages/example-venue-name/234h23o4ub23. I don't have the "example-venue-name" segment of the URL stored in my database making this method very difficult. Is that page going to register that it was liked or do I have to do the entire URL?
The URL on the like button is actually just what the user will follow back, so as long as the user can follow the link, you will be fine. The link is the unique tracker to the object so that Facebook knows distinct objects.

facebook and opengraph (ap id question)

I am integrating a like button into one pf my pages, using the information here.
I want to use Open Graph Tags, but that requires supply of fb:admins or fb:app_id tag elements. The thing is that I cannot find any information on how to obtain these IDs.
The Id is that likes on the webpage appea on the wall of the facebook page (Note: NOT a user profile). Does anyone know which ID to use, and where to get the ID from?
You can get your own user id to put into the fb:admins field by logging into facebook and then going to this url:
https://graph.facebook.com/me/?access_token=2227470867|2.AQCPDqXNTW9FwNw9.3600.1311487200.0-29000387|0aZ4-swEk1RJo8PWMgzAqj-Daqs
The id field is your uid aka user id. If you don't have an app id, don't worry about it. You only need fb:admins OR fb:app_id. Not both.

site URL for the facebook like button

I have a problem with the Facebook like button. I want the note on user's profile to look something like this: 'User likes page on site'.
Site's URL it suppose to be 'http://www.example.com/myapp/' and the page URL it's 'http://www.example.com/myapp/page.html'.
I added <meta property="og:site_name" content="..."/> in the of any page and added the like button using <iframe>.
I know that there's a solution to specify the canonical URL, but for the page that user likes, not for the site (that is by using og:url on the header). Does anyone know how you can specify the site's URL? It somehow automatically points to the domain name, which it's wrong in my case because i need 'http://www.example.com/myapp/', not 'http://www.example.com'.
I want the following result: User likes 'http://www.example.com/myapp/page.html' on 'http://www.example.com/myapp', not User likes 'http://www.example.com/myapp/page.html' on 'http://www.example.com'.
Thank you very much for a possible answer.
We've been running into similar problems and in lieu of a og:site_url tag have had to get a little hacky. Our solution is to have our base URL (http://www.example.com in your example) redirect to the FB page.
As we add more FB pages, we'll need multiple subdomains to support this, so it's not really sustainable, but may solve your problem at least temporarily.