Do Facebook Like Buttons require an App ID?
Asked Answered
D

5

33

When going to the set up pages for all the Social Plugins, they now provide example code using an APP ID.

http://developers.facebook.com/docs/plugins/

Is an APP ID now required for the Like Button and other plugins? What happens if an APP ID is not included when using the plugins?

I've checked the Facebook developer blog and read about the Like Button Migration. I haven't been able to find a straight answer for this either there or in the FB Like Reference.

Donella answered 29/11, 2012 at 21:37 Comment(0)
A
14

Notice:

This is an old dated information, the official facebook's behaviors are changed.

Simply, the answer is No, just look at the following official Facebook resource.

Notice: To do it without need to the app id, you have to visit the above page when you are signed out from Facebook. Look at the following screen shot.

enter image description here

Annual answered 29/11, 2012 at 21:41 Comment(8)
Simply, I am looking at that page. The "Get Code" option includes an APP ID. It has a field that says "This script uses the app ID of your app". There is NO option for code WITHOUT an APP ID. There is no explanation on the page about why an APP ID is included. There is no explanation on the page what happens if you do NOT use an APP ID. So really, your answer provides no help at all.Donella
I believe it's referring to the part which says 'fb:admins or fb:app_id - A comma-separated list of either the Facebook IDs of page administrators or a Facebook Platform application ID. At a minimum, include only your own Facebook ID.' - you can a user ID here if you want to have access to the created open graph objects - if not, you don't need a user ID or app IDRelinquish
Simply sign out from Facebook and visit this url again be sure there is no auto login to the facebook.Annual
Semsem, thank you for your help. While signing out of Facebook does get rid of the APP ID, it does not address my questions. Your suggestion is only a work-around and does not answer the problem. That is, why is the APP ID there? Why was this change made? What does it mean?Donella
When you are signed out and click on 'Get code' Facebook asks you to sign in.Tridactyl
Currently, if you try to 'Get code' when you are signed out, it forces you to sign in.Expellant
Doesn't work anymore. Please edit or delete your answer.Skiba
As of 2017 this works without needing to be signed in. Worst case, you can remove the AppID from this line of the JS: js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.8";Gelasius
R
4

According to Facebook's Social Plugins FAQ

  • Web: If you are using Social Plugins on the web, you do not need to create a Facebook app for integrating a Social Plugin.
  • iOS/Android: If you are using Social Plugins within a iOS or Android app, you need to create a Facebook app and tie it to your app identifier.

It seems that the official answer is that they are only required for iOS/Android.

Raimes answered 14/12, 2016 at 21:53 Comment(1)
I see "Web: If you are using Social Plugins on the web, you need to have a Facebook Developer account in order to get an app ID.". Again "need to". Is this perhaps a recent change and that why 100% of the answers are wrong?Doubleminded
L
3

As semsem said, the simple answer is "no it is not required"... there are ways to get around having an appId associated with the "like" button. Here's my experience working with this. I'm not a Facebook or Open Graph expert, so YMMV.

Why we avoided using the appId on the button:

We're providing an service where we have one website (the engine, as it were) that provides a service distributing online courses to students (customers). Instructors (also customers) who what to use our service to disseminate courses to students can brand the site how they wish, and map their domain to their section of our website that serves those course(s).

As a simplified example: we serve from http://courses.example.com/instructor_name, but we want students to access the content through http://www.instructors-domain.com/. Any courses would be sub-directories off the base URL.

Associating the "like" button with our Facebook App disallows any cross domain shenanigans. While there are valid reasons for doing so, it doesn't work for where we're at in our company and product evolution. So we needed to find a workaround.

We wanted to allow folks to "like" a course, have the "story" point to the appropriate places on the net, as well as get some customization (e.g. "NAME likes an online course on FBAppName"). We basically achieved this. We lost some functionality which we deemed acceptable at this point in our evolution.

The short of it

I used the iframe version of the Facebook "like" button as dictated by the appropriate Facebook developer's page (for the link see semesm's answer for the link, I got no rep). I took their code snippet and manually removed the appId query string in the iframe's src.

In the "liked" page itself (which was the same page that had the "like" button) I used the Open Graph meta tags including specifying the appId. (These tags were specified: fb:app_id, og:type, og:url, og:site_name, og:title, og:description, og:image.)

The og:type was our custom type of the form 'namespace:app_custom_object_name'.

A failed approach

My first attempt was to use what I understand as the preferred method, the "HTML5" tab in the "Get Code" section of the developer's "like-button" page. I tried their method stripping the appId from the appropriate places. This method proved ineffectual.

If the domain doesn't match that in the Facebook App, there will be no "like" button.

If the domain does match, the "like" button will appear. However, it takes 3 clicks to actually "like" something. The first click changes the "thumbs-up Like" icon to a normal anchor with one word that didn't make obvious sense (I forgot what the word was). The second click will brings up the login/authorization window for using our app. The third actually bring up the modern fancy "like" box where you can type in a comment. I didn't find a way around this behavior.

Note that when I specified the appId in this approach on the appropriate domain, it worked as one would expect (though inconsistent with our desired behavior).

I did not try the other two options in the "Get Code" section of the "like-button" page.

Informed speculation and rumor

In my research around this, my overall impression is that requiring an appId is the way of the future for Facebook. Who knows if the old way will be depreciated, probably never, though I didn't find anything in the docs talking about this "legacy" behavior. This makes sense to me with their newer offerings and the advanced tracking that becomes available with this method.

I've seen suggestions that the "likes" used in this manner are akin to second-class citizens... treated as inferior in some respects. In my own experimentation I found the behavior of the fully specified appId (in the "like" button itself) to be different and more accessible and predictable (in terms of Open Graph queries and visibility on my limited Facebook tests) than the partially specified appId. (Again, I've found no solid documentation on this, and did not endeavor to full grok the differences.)

May this info help someone else along. Good luck!

Lyssa answered 20/12, 2013 at 22:19 Comment(3)
While this is a pretty solid answer, it's very long and doesn't necessarily answer the OP's question. Best to keep your answers short, concise, and easy to identify the solution at a glance. Also, opinions should be left out unless they can be backed up by references.Veratrine
That's harsh. The answer starts with a TL;DR and provides useful information. Its too long to be a great answer, but I don't see it warranting a downvote. Welcome to StackOverflow, FlyDanoFly, and thanks for the extensive effort put into your first answer!Paramagnet
not harsh. time is money. it's eg completely irrelevant what his website doesAdvise
O
3

So, I just tried the sємsєм method, as comments say: Facebook want you to login to get the code, and if you have an app, you have to choose one.
But if you don't, it gives you a code without any app reference.

So when you get a code – no matter any app you choose –, you just need to remove the appId parameter in the .js URL (&appId=##############), and you got (for the latest HTML5 code, 6th line):

js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";

The code for the div element does not change.

Ornis answered 10/1, 2014 at 14:22 Comment(4)
When I try it like that, all.js throws this error: "Invalid App Id: Must be a number or numeric string representing the application id."Loyalist
Price to pay if you do not want to create app ID, I guess. But still works fine. Note that it be a user ID (with meta og) – developers.facebook.com/tools/debugOrnis
This actually breaks for me in IE8...if no App ID is provided, the share button doesn't even appear. Very frustrating.Trossachs
Since the code snippet is HTML5, I guess that if you want to support IE8, you got to use the iframe snippet. Does it break too?Ornis
A
3

I simply use the URL code inside an iframe tag without an appID and it seams to work,

here is an example:

<iframe src="http://www.facebook.com/plugins/like.php?href=<%=request.original_url%>&width&layout=button_count&action=like&show_faces=false&share=false&height=35&appId=" frameBorder="0" width="150" height="25">
</iframe>
Albert answered 26/5, 2014 at 22:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.