facebook like: href url vs. canonical url - facebook

for tracking purposes, I want that the URL, which appears on the facebook stream after an "like-action", is slightly different from the URL the user actually liked.
Example:
I use <link rel="canonical" href="http://example.com/test.html"> in my head section to tell facebook to which URL a like-action on this website refers to.
Further down on the website I have <fb:like href="http://example.com/test.html?param=144141"> with the same URL, just with an additional parameter.
My intention: If someone clicks on the like button, facebook puts him to the "group who like http://example.com/test.html" in order to appear next the like button. But when another user sees his like-action on the facebook stream and clicks on it, he should be redirected to http://example.com/test.html?param=144141.
The problem is that this doesn't work, because the canonical declaration in the head section kind of overwrites the href attribute of my <fb:like> tag. Anyone knows how to solve this problem or does it simply not work?

You can't do exactly what you have requested, but you can still add an arbitrary tracking parameter (especially useful for analytics purposes). Facebook recently added a ref parameter to the fb:like element for this purpose. It's up to you to decide how you want to stuff various bits of information into that single parameter and then parse fb_ref whenever it's included in an incoming URLs.
Example
Place the following element on your HTML page:
<fb:like href="http://example.com/test.html" ref="144141"></fb:like>
Users clicking the link from Facebook should be directed to:
http://example.com/test.html?fb_ref=144141&fb_source=home_multiline
Documentation
"Adding More Features to the Like Button" blog post
fb:like button documentation

Related

Facebook sharer and parameters in url

I have a Wordpress page that needs a GET parameter in URL.
Depending on the id, it shows a different flipbook.
The problem is, when I share the link on Facebook, it crops the GET parameters (I checked with the Open Graph Debugger), so the page doesn't receive any parameter, thus there's no thumb showed.
I already tried encoding the URL with PHP.
So, two questions:
Is it possible to make Facebook recognize the GET parameters in URL?
If not, can I work out something with the .htaccess file, to make them appear like subpages? E.g. www.page.com/flipbook/?id=7 would become www.page.com/flipbook/7/
The problem was SEO Yoast was automatically writing the tag:
<meta property="og:url" content="www.page.com/flipbook/">
So Facebook was reading this and not the parameter.

FB Like button unlikes itself

Recently facebook rolled out some changes which have apparently broken like button functionality on on pages I'm working on, particularly for urls that point to a photo (photoset) on facebook, e.g. a facebook button like
<fb:like href="http://www.facebook.com/photo.php?fbid=ID&set=SET" ....></fb:like>
The button renders, however when I click 'like' it immediately 'unlikes' itself afterwards. *Non-facebook URLs work fine with the like button, only URLs that point to photos/content on facebook cause the like button to immediately unlike itself after it's clicked. The buttons are generated via the JSSDK as iframes. Is there a solution to this problem? We're not using og metadata.
Facebook like buttons strips all the get parameters of urls, so although you have this
<fb:like href="http://www.facebook.com/photo.php?fbid=ID&set=SET" ....></fb:like>
The url retrieved by facebook is this
<fb:like href="http://www.facebook.com/photo.php" ....></fb:like>
EDIT
As you may have not noticed on the 10th of july one of the break changes is the url of the social plugins
Social plugins will require an absolute URL in the 'href' parameter
Social plugins, such as the Like Box and Like Button, will require an
absolute URL in the 'href' parameter.
https://developers.facebook.com/roadmap/#q4_2013
I've always encountered issues with using Facebook's developer tools with resources on its own domain and, for that reason, always recommended "proxying". In other words, you would create a unique resource on your web server to represent the Facebook photo, this resource would garner likes and shares, but when a user visited the page, they would be redirected to the real photo.
For example:
<fb:like href="http://www.example.com/fakeresources/photo.php?fbid=ID&set=SET" ....></fb:like>
When you load http://www.example.com/fakeresources/photo.php?fbid=ID&set=SET:
<meta property="og:title" content="The Rock" />
<script>top.location.href="http://www.facebook.com/photo.php?fbid=ID&set=SET";</script>
Unfortunately, for the og:image tag, you will also need to create a proxy, because the Facebook scraper will often not fetch from its own servers.
I've even encountered times when Facebook will not fetch from a URL because the URL has a query parameter which looks like a URL which is on its own servers, for example:
http://www.example.com/fakeresources?url=facebook.com/photo.php?fbid=ID&set=SET
(query parameter not url-encoded for readability)
For which, encoding the URL with rot-13 is sufficient.

Like Box ('Could not retrieve the specified page. Please verify correct href was passed in.')

I need some information, why like box frame not working: 'Could not retrieve the specified page. Please verify correct href was passed in.'. I`m testing this href in http://developers.facebook.com/tools/debug - it says correct answer, but frame not working.
In access logs for UA facebookexternalhit/1.1 always answer status 200 (and 301/302 for specific page).
example page: http://www.now.ru/item/series/comedy/Univer_222394
additional information: on some pages frame works, and some does not work
thanks.
The Facebook Like Box is really designed to use the URL for a Facebook page, not for a general Web Page. It pulls Timeline content from a fan page within Facebook.
It can be used for a Web Page if the page has defined Open Graph Meta Tags and has been Liked at least once. However, there will be no "stream" functionality. The Like-Box for a Web Page would just have functionality similar to the Facepile plugin (except that Facepile just shows you friends, and a Like-Box also shows non-friends.)
Typically, though, you would want to supply the Like-Box with a Facebook Page URL in the following format:
http://www.facebook.com/pages/Facebook-Page-Name/Facebook-Page-ID
Perhaps you are intending to use a Like Button or Facepile Social Plugin instead? Either of those can accept any URL as input.

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.

How to like / share URLs inside Facebook that contain get-parameters

We are working on a facebook-app with lots of dynamic pages. As the app is embedded in a tab on a facebook page, the urls contain a get-parameter to address the correct tab/app. We want to implement like- and send-buttons for several pages within our app, but facebook seems to dump all get-parameters from urls within facebook. As the result all like- and send-buttons point to the facebook-page itself instead of the tab.
Does anybody now any workaround? We already tried redirects via an external sefor facebook urls only.rver but facebook seems to evaluate the links on click of the like-/send-button (and seems to follow all sort of redirects).
UPDATE:
Here is an example of a problematic url:
https://www.facebook.com/smartmobil.de?sk=app_171502639574871
UPDATE:
The problem seems to be independant of url get-parameters. It seems that the like-button does not work with any url starting with www.facebook.com
When used in a like-button everything behind the ? will be dumped. This seems to happen for facebook urls only.
Best workaround so far is to point your like buttons at external (non-facebook canvas) urls.
To make this work, you need to do some conditional redirecting to get the user back into your canvas URL. You can either use a client side javascript redirect:
<script>
window.location = 'http://apps.facebook.com/yourcanvasname/foo/bar';
</script>
Or you can do a server side redirect based on the useragent string. Basically, if the useragent contains 'facebookexternalhit' then render a basic HTML page containing OG tags, if not, redirect to the canvas URL.
Doing this means the Facebook sharescraper/linter won't follow any redirects back to the canvas URL, but any user that arrives at your URL will get back to Canvas.
i'm too searching for a solution to control the custom page tab's content through a get parameter (app_data). I still don't have a solution but here at least the reason why all www.facebook.com links are srtiped out of get params. Here at bottom the developer explains why.
Unfortunately I don't think what you are trying to do is possible. Posting a like programmatically requires you to specify a Facebook content ID or alias. This won't work for you because tabs to not seem to have an exposed content ID of their own, and instead use the Page's content ID with an additional parameter which you can't use with the graph.
Liking external links and other content that does not have an ID programmatically is prohibited. With an external URL, the first like of an unrecognised URL creates a new Facebook page for those likes to be represented on (which is the issue I've given up trying to fight), but presumably the presence of your Page's content ID alias (www.facebook.com/smartmobil.de) in the url is making Facebook choose you page rather than creating a new one.
The only suggestion I can think of this late at night is to target an external URL that performs a redirect via Javascript, rather than on the server, but Facebook may be wise to that too and I'm afraid I'm going to bed rather than testing it :)