Facebook "like" button shows count of homepage instead specific article - facebook

I have a website with a news section, and I want to put individual "like" buttons in each post. The problem is that the buttons shows the root like count and not the count of that specific page/post.
And the weirdest is that it works in one of the pages, but not in the others.
This is the page with the buttons working and this is one of the pages where te button isn't working.
I've already read all the content of facebook's social plugin and open graph, and I still don't understand what's happening.
This button don't work:
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=218284238205675&xfbml=1"></script><fb:like href="http://eepolitecnica.org.br/noticias/valor_poli_cria_primeiro_fundo_de_universidade/" send="true" layout="button_count" width="150" show_faces="false" font=""></fb:like>
and this works fine:
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=170199966377672&xfbml=1"></script><fb:like href="http://eepolitecnica.org.br/noticias/jornal_nacional_exibe_materia_sobre_o_eep" send="true" layout="button_count" width="150" show_faces="false" font=""></fb:like>
These are some relevant meta tags I have
<meta property="og:type" content="article" />
<meta property="og:url" content="<?php echo $base_url, $site_url; ?>" />
Is that a common bug from FB's Like button as it seems or I'm really doing something wrong?
Sorry about my terrible english...

Remove the trailing slash in the version that doesn't work. This trailing slash is causing your urls not to match and so facebook is defaulting back to the base url
eg:
<fb:like href="http://eepolitecnica.org.br/noticias/valor_poli_cria_primeiro_fundo_de_universidade" send="true" layout="button_count" width="150" show_faces="false" font=""></fb:like>

Try using FB's linter tool: https://developers.facebook.com/tools/lint/
Enter the URL for your different pages and see what FB is actually seeing from the XFBML tags on your page. This might shed more light or post back results here.

Try this
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:like href="http://www.facebook.com/account-name" send="true" layout="button_count" width="150" show_faces="false" font=""></fb:like>

Related

Facebook like button posting wrong url to wall

I have a facebook app displayed on my page via an Iframe . I have included the following code on my page to generate the like and comment block .
<div class="my_page_footer">
<script src="https://connect.facebook.net/en_US/all.js"></script>
<div class="my_page_likes">
<fb:like href="<?=$canvas_url;?>" show_faces="true" width="570" font="verdana"></fb:like>
</div>
<div id="fb-root"></div>
<div class="my_page_comments">
<fb:comments href="<?=$canvas_url;?>" num_posts="5" width="570"></fb:comments>
</div>
</div>
Where the canvas url is the iframe src to my app.
However when anybody clicks on Like the iframe src url is posted on their wall instead of the name of the app or the link to the app
Any thoughts ?
Neil
Facebook figures out what to display for a URL using Open Graph headers. For example:
<meta property="og:title" content="..." />
<meta property="og:url" content="..." />
<meta property="og:image" content=""..." />
You can use the OG debugger tool to figure out if your headers are setup correctly.

Facebook Like Count different for iframe vs JS SDK on same page! Why?

Problem :
When we switched from the Facebook iFrame like button code to the HTML5 JS SDK button, the like counts for our pages got completely reset! (400+ likes went to 0 in some cases). We've waited close to a week, as well as pushed links through the linter and there have been no increase to the previous values.
Verification :
When we run both types of buttons on the pages together, the iframe still shows the larger / original like count. Test link (will only have 3 buttons for the next ~12 hours)
Screenshot : 3 Like buttons on the same page (iframe, JS-SDK w/ url encoding & JS-SDK standard)
The Like Button Code :
I thought perhaps it was due to url encoding, so the difference between the 2nd and 3rd buttons is url encoding on the web address. The first button is the iframe.
<td><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.team-bhp.com%2Fforum%2Fshowthread.php?t=$thread[threadid]&send=false&layout=button_count&width=450&show_faces=false&action=like&colorscheme=light&font=verdana&height=21&appId=106794169377106" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:110px; height:21px;" allowTransparency="true"></iframe>
</td>
<td align="left" valign="middle" style="width: 90px">
<div class="fb-like" data-href="http%3A%2F%2Fwww.team-bhp.com%2Fforum%2Fshowthread.php?t=$thread[threadid]" data-send="false" data-layout="button_count" data-width="90" data-show-faces="false" data-font="tahoma"></div>
</td>
<td align="left" valign="middle" style="width: 90px">
<div class="fb-like" data-href="http://www.team-bhp.com/forum/showthread.php?t=$thread[threadid]" data-send="false" data-layout="button_count" data-width="90" data-show-faces="false" data-font="tahoma"></div>
</td>
Meta tags :
Meta tags show up fine in the facebook linter/debugger (though "og:image", "og:description" and "og:url" aren't explicitly specified)
<meta property="og:title" content="The 2012 Budget & the Indian Car Scene : All you need to know - Team-BHP" />
<meta property="og:type" content="article" />
<meta property="og:site_name" content="Team-BHP.com" />
<meta property="fb:admins" content="1504944662" />
<meta property="fb:app_id" content="106794169377106" />
HELP!
Why is this happening??
Is the iFrame also showing likes accumulated on facebook itself?
Has the "app_id" suddenly come into effect only for the JS-SDK button?
Any insight would be appreciated!!
Thanks,
R
I took a look at the source of the test link you provided, and the iframe src has this value:
//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.team-bhp.com%2Fforum%2Findian-car-scene%2F117538-2012-budget-indian-car-scene-all-you-need-know.html
As oppose to the other two plugins which have
http://www.team-bhp.com/forum/showthread.php?t=117538
or
http%3A%2F%2Fwww.team-bhp.com%2Fforum%2Fshowthread.php?t=117538
as their data-href.
Looks like the iframe uses the pretty url while the other two are using the short verion, and since you are using different urls you are getting different results.

Facebook Like button in wordpress theme

I have put a facebook Like button on my 'single.php' page and i am receiving the following error:
The page failed to provide a valid list of administrators. It needs to specify the administrators using either a "fb:app_id" meta tag, or using a "fb:admins" meta tag to specify a comma-delimited list of Facebook users.
This is my code:
<div class="fb-like" data-href="<?php echo get_permalink(); ?>" data-send="false" data-width="450" data-show-faces="true"></div>
I have also added the following meta tags (with the correct id's):
<meta property="fb:admins" content="<FB ID HERE>"/>
<meta property="fb:app_id" content="<APP ID HERE>" />
Any ideas?
Did you try the different tips you can find here :
I Like Button Problem - Facebook
You will find many ways to remove this problem.
I hope it will work for you.

FB Like Counter Not Showing Individual Results for Each Page

The code below is placed in the header and called via php to every page of the website. (It's WordPress.)
The counter shows the like counts for the home page on every article. Any way to make it show the count for individual articles? (this is the site)
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1">
</script><fb:like href="http://GlamourUnderground.com" send="true" layout="box_count" width="55" show_faces="false" font="arial"></fb:like>
</div>
Thank you,
Tara
You have to put the permalink to the actual article in the <fb:like> tag, not just the home page.Try...
<fb:like
href="<?php the_permalink()?>"
send="true"
layout="box_count"
width="55" show_faces="false" font="arial"></fb:like>
This will work whenever you've called the_post(), e.g. on individual posts and pages and when you are in the "loop".

Why does my Facebook Like button create a brand new Facebook page?

I'm trying to integrate Facebook into a site I'm developing, I have created a Facebook Page for the business & a Facebook app too - I am very confused with the documentation & terminology that Facebook uses.
I am using FBML to add a Recommend button to the footer of my site so that users can recommend that particular page but when I click on it, it creates a brand new Facebook page for that URI & seemingly ignores all the facebook & open graph metatag info.
FYI, these are the metatags that I'm using:
<meta property="og:title" content="My Page title"/>
<meta property="og:type" content="company"/>
<meta property="og:url" content="http://mysite.com/"/>
<meta property="og:image" content="http://mysiteimage.jpg"/>
<meta property="og:site_name" content="My Site Name"/>
<meta property="fb:admins" content="My_FB_Admin_ID"/>
<meta property="fb:page_id" content="My_FB_Page_ID" />
<meta property="fb:app_id" content="My_FB_App_ID" />
<meta property="og:description" content="Desctiption of page"/>
This is the FBML I'm using:
<fb:like width="940" action="recommend" font="lucida grande"></fb:like>
This is the Facebook Javascript SDK code I'm adding to each page before the </body> tag (it is only being added once per page):
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({appId: 'My_FB_App_ID', status: true, cookie: true,
xfbml: true});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
Does anyone have any idea what the heck I should be doing? Should I be using an app as the fan page or the page I'm already using??
I would also really like to be able to 'Like/Recommend' the actual Facebook page from the site, is this possible?
Many thanks in advance.
Zander
The issue has to do with the meta property og:type. Anything other than article like a video/audio etc. will create a new Facebook Page on the open social graph.
If you set og:type to article, or remove it altogether, the issue will go away.
I hope that helps.
No mather where you place the "like" button you can specify the url on it, so in this wayonly one "page" is created ex:
your created html location = http://mywebsite.com
some other stuff
<!-- like button -->
<fb:like href="http://mywebsite.com" layout="button_count" show_faces="false" width="200" font="lucida grande"></fb:like>
<!-- end like button -->
your other created html location = http://mywebsite.com/help
some other stuff
<!-- like button -->
<fb:like href="http://mywebsite.com" layout="button_count" show_faces="false" width="200" font="lucida grande"></fb:like>
<!-- end like button -->
as you see here no mather what page your "like" button allways create the same page, even more you can specify your page aplication on it.
Remember even the "meta property" tags allways will create the same page if you specify the url and same content, if you left some part blank the facebook api will asume the current url and not will take any of the other parameters.Tha same apply to comments you can have the same comments box with the same comments on it if you specify the url.