Facebook Like button_count not working unless logged in - facebook

I have added the Facebook button "LIKE" code below:
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-like" data-href="https://www.facebook.com/mypageinfacebook?sk=myappId" data-send="false" data-layout="button_count" data-width="21" data-show-faces="true"></div>
But the like count is not seen on my site, it could be seen only after login in to Facebook account.
How to fix it?

your code wise no wrong..,
Check your data-href link has valid one,
data-href="https://www.facebook.com/mypageinfacebook?sk=myappId"
i tried this code with my fans page url its shown the like counts perfectly..
otherwise,
the page which users wants to like might having '0' likes.
if that case means count wont show.

I think you better to use this one this reference is working..
http://developers.facebook.com/docs/reference/plugins/like-box/

Posting this response for other users that come across this post.
"It seems you are using restriction on "minimum age" or "country" on your page.
That mean facebook can't display a like box, without knowing who is connected, because he can't know the age or the country of the current user."
All credit to AHWEBDEV
Link

Related

Facebook share and like buttons stopped counting

I have share buttons on every article on my page which just stopped counting shares since yesterday.
Pages gets normally shared on facebook, but share counter does not get incremented.
Old posts are displaying correct counts, but any new share is not accounted.
Code for my share button is generated on their page
https://developers.facebook.com/docs/plugins/share-button
and it looks like this:
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.9&appId=APPID";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-share-button" data-href="URL" data-layout="button_count" data-size="small" data-mobile-iframe="true"><a class="fb-xfbml-parse-ignore" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=URL&src=sdkpreparse">Share</a></div>
Am I doing something wrong, or facebook went nuts?
EDIT:
Social button increments properly if there is 1 or more share on it (older articles). Ones with 0 shares are shared properly, but not counted/incremented.
It was an issue with facebook itself.
I've reported it and their developers have resolved it.

Like a specific post of the timeline of a Facebook page from an external website

I've some trouble with the Like Button. I would like to like a specific post like this one from a external website but it doesn't work:
https://www.facebook.com/236086869778323/posts/597301643656842
For this button I used the following code, which is given by Facebook Developers
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/de_DE/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-like" data-href="https://www.facebook.com/236086869778323/posts/597302473656759" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>
When you read the documentation about the Like Button it states
A single click on the Like button will 'like' pieces of content on the web and share them on Facebook. You can also display a Share button next to the Like button to let people add a personal message and customize who they share with.
These pieces of content are external. That is the Like Button is intended to be used for webpages outside of Facebook to share in Facebook.
You will need to use Embedded Posts instead https://developers.facebook.com/docs/plugins/embedded-posts/

Facebook Send/Like buttons not working on my site page

When I clicked the LIKE or SEND buttons on my site for this link, I get this error:
The page at http://aftersqool.com/a?id=C217EE could not be reached.
Strangely, the page is loading without any issues. The page even has the og tags that Facebook requires.
Anyone know why Facebook is giving this error? What should I do to get the buttons working?
Thanks!
Gus Collazo
AfterSqool.com
You can’t use the Send Button if you’re using Facebook as a Page instead of a Personal Profile.
The Send Button only works with XFBML version of the Like Button; it doesn't work with the iFrame version of the Like Button, per Facebook’s announcement
One more important thing is to provide your facebook page's URL in send and like button. It will defiantly fix it.
If your facebook page URL is: http://www.facebook.com/aftersqool
put this code in it
/*put this code in body*/
<div id="fb-root"></div>
<script>
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id))
return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
/*put this code in site where you want to add it*/
<div class="fb-like" data-href="http://www.facebook.com/AfterSqool" data-width="450" data-show-faces="true" data-send="true"></div>
I could not get Smit Shilu solution to work. I had to remove xfmb=1 to get my buttons to work. Full solution here.
http://metadataconsulting.blogspot.ca/2013/09/facebook-likesend-button-not-working.html

facebook like button with message

Can anybody tell how is it possible to create a facebook like button with the option to add a message? example can be found here http://www.familycircle.com/style/beauty/hair/summer-hairstyles/
If user does not write anything as a message, the button behaves like normal like button. If user writes a message, it will appear on his/her wall. Thank you.
As Facebook says:
When will users have the option to add a comment to the like?
If you are using the XFBML version of the Like button, users will always have the option to add a comment. If you are using the iframe version of the button, users will have the option to comment if you are using the standard layout. If users do add a comment, the story published back to Facebook is given more prominence.
Like Button
that's the normal behavior of facebook's like button. You have the option of writing a comment or message, and here's how I do it, with HTML5
put this after the body tag
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=YOURAPPID";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
put this where you want to see the button
<div class="fb-like" data-href="http://someurl.com" data-send="true" data-width="450" data-show-faces="true"></div>
Or create yours here

Comments box acting unexpected

I am tring to implement the comments box into my website, providing the following code:
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=204934639590323";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-comments" data-href="http://my_web.com/" data-num-posts="2" data-width="500"></div>
When i post a message into the comments box, that message is not posted onto my wall. Also, when i logout from fb, that message dissapers. Hope to give me some ideas. Thanks.
If you logout of Facebook and then the comment disappears it seems a privacy configuration on your account, that's why when you become anonymous Facebook hides the comment.
Also, if the comment is not posted (despite you check you want this behavior on the comment box) maybe your app is in sandbox mode OR again you have specific configurations for this app.
To quickly have a better idea of what is going on you could ask someone else to comment.
Hope that helps.