Putting referral URLs into Facebook Like button - facebook

I have a site that has referral links. It is set up so that http://site.com/refer/abc redirects to http://site.com/destination.
Whenever I enter http://site.com/refer/abc as the data-href for Facebook's Like button, though, it just rewrites the link as http://site.com/destination, which causes me to lose referral tracking.
Any way I can keep the referral link with the Facebook Like button?

I solved this by checking to see whether it was a bot or human that visited http://site.com/refer/abc. If you're using Rails:
request.env["HTTP_USER_AGENT"].match(/\(.*https?:\/\/.*\)/) ? "is robot" : "is human"
If it was a human, I let it redirect like normal. If it was a bot I just rendered the page with no redirect - the same one that the human would see at http://site.com/destination. This made Facebook keep the original referrer URL but still display the relevant meta tags for that page when someone Liked the page.
EDIT: I've found that if you want Facebook to crawl your Like button right as it's created, you need to curl Facebook's URL linter each time a new button is created:
curl https://developers.facebook.com/tools/lint/?url={YOUR_URL}&format=json
This will update the Like button metadata immediately. More info here.

Related

Facebook share change link text

When adding a share button to my site as follows:
https://www.facebook.com/sharer/sharer.php?u=http://www.domain.de/christmas-gewinnspiel
When I click the button, it takes me to facebook and the the post to wall page, but the link text says "www.domain.de" although the URL of that link is correct ie. (http://www.domain.de/christmas-gewinnspiel), how can I change the the link text?
The page url is giving a 404 response. I think showing the basic domain is the standard behaviour for sharing, the link itself (if you'd click on it) is the correct one, but giving a 404 as described.
Also, think about adding the OpenGraph meta tags to make the shared info look nicer:
https://developers.facebook.com/docs/reference/opengraph/object-type/website/

Why does facebook change the url when I click on a link?

Suppose that I click on a facebook link -- once clicked, the URL is transformed to this:
http://www.facebook.com/l.php?u=http%3A%2F%2Fapple.stackexchange.com%2Fquestions%2F398%2Fhow-do-i-build-apps-to-my-jailbroken-ipad&h=uAQFM5WKt
And then I'm redirected to the URL I thought I was going to. Why does facebook do this?
Facebook keeps track of all the links fired from its website. It saves the url you provided as link.
First it forwards you to a facebook link where it saves the url and then it redirects to the actual url.
This way facebook knows which urls are getting most hits.
FYI, Even google does it.

When I (facebook) like our video on our site, it turns into a page

as the subject describes, when I facebook-like an video-item or other type of page of our homepage, it turns into a whole "facebook page" instead of a timeline-post.
Why is that?
I have tried to lint it at the facebook-linter, and it says that there's noting wrong. The type of the video is "video.other".
E.g: http://metopia.se/tube/NKQeT/lanterna-education-summer-courses
When I liked that page, it turned into this page:
http://www.facebook.com/pages/Lanterna-Education-Summer-Courses/334204833309981
Which I am admin for.
Am I doing something wrong here?
You're not doing anything wrong; this is expected behavior:
Website owner puts FB Like button on site.
Website visitor clicks said Like button.
Timeline story is generated for the website visitor. It appears on his timeline and in his friends' News Feeds.
I liked the page myself to confirm.
What you're seeing is expected if you have liked the page and have also designated yourself as an admin for the page (i.e., whoever is denoted via the fb:admins Open Graph meta tag). Judging by that page's source I'm guessing you're either Adam or Mathias?
You should read up on Facebook's Open Graph protocol. In short, putting a Like button on a website will create a corresponding Open Graph fan page for whatever location is referenced by that Like button's href attribute.

Like button for Facebook page shows generic Facebook description in News Feed

I want a Like button on my web site that Likes my Facebook profile (rather than my web page), so that when a user clicks it they subscribe to my Facebook posts.
I've created the Like button using the tool at https://developers.facebook.com/docs/reference/plugins/like/
Further down that page there is an FAQ entry:
Can I link the Like button to my Facebook page?
Yes. Simply specify the URL of your Facebook page in the href
parameter of the button.
So, I've edited the href parameter to point to my Facebook page. eg:
https://www.facebook.com/myfacebookid
When a user clicks the Like button it has the desired effect. The user ends up having Liked my Facebook page. This is easily verified by the user going to my Facebook profile and checking that the Like button has changed to Liked.
But. When the user clicks the Like button, and entry appears in their News Feed with a generic Facebook description. ie:
Facebook is a social utility that connects people with friends and
others who work, study and live around them. People use Facebook to
keep up with friends, upload an unlimited number of photos, post links
and videos, and learn more about the people they meet.
I don't want a generic post about Facebook to appear. I want the description to relate to my Facebook account and/or web site.
Normally, I could modify this behavior with the Opengraph og: description tag, but as the page in the href is a Facebook page and not my own, I can't control the Opengraph tags.
I'm pretty sure that this was working okay before I enabled timeline for my account, so maybe this is a timeline bug?
So, how do I add a Like button which a) Likes my Facebook profile rather than one of my own web pages, and b) Posts a description of my Facebook profile rather than give a generic Facbook description?
Are all your fields in the info part of your page filled in, and/or completed? I just tested your theory and it seemed to work as expected, only thing is I know all fields in "info" are filled it. Give that a try.
This may happen if you have filled invalid/incomplete/wrong og tags in past and later changed them. Facebook's cache creates problem sometime.
Try putting all the entries (i.e. all og tags) and then debug them here http://developers.facebook.com/tools/debug. This debugger gives a detailed info about the url with og tags and also clears the cache for you.
This should solve the problem.
You have 3 important fields that used on page opengraph: Name,Description,Profile Image.
They are used when some one post your link on Facebook, or Google or some else web service that handle opengraph.
Actually, the suggested answers currently do not work and there is an open bug / ticket on Facebook for it. Up to now, there's no fix.
The problem is that you can not use simply https://www.facebook.com/myfacebookid. You should copy and paste the exact page URL. If you have a low number of likes it would look something like https://www.facebook.com/pages/[YourPageName]/[Your page Id]/, and this is the URL that you should use at this point.
If it does not work, try also https://www.facebook.com/[YourPageName]/[Your page Id]/.
In short, copy-paste the URL, do not type it manually.

Facebook Like Button Keeps Resetting

I'm trying to add a facebook "like" button to my page, and it is appearing just fine. My problem is that once it is clicked by a user, it says "Like NUMBER" then resets as if the request was canceled or something.
The weird thing is that if I try to like a page using my facebook account it works, but I tried letting a friend like some content and this behavior appeared.
I created a facebook app, specified the site url with a trailing slash, and site domain. I used the app ID with FB.init, and with the open graph tags. I can't figure what I'm doing wrong here. Any help would be appreciated.
Sample page can be found at: http://wiseolive.com/en/doctors/3881-khalid-jamal-salaymeh
First, for the count to work correctly, Facebook needs to have access to the page (in other words a public page). Check your URL in the linter tool (https://developers.facebook.com/tools/debug) to ensure it can been seen by Facebook.
Secondly, ensure your og: tags are correctly setup. Once again, you can use the linter tool to do that.
Facebook like buttons will show this behavior until they have been scraped by Facebook. That scraping (facebook like docs) will occur every 24 hours, when an admin clicks the like button or the url is put in the url debugger/linter. From what I can tell doing that will solve the problem for that specific link, but not any others you may have on your site.
I don't know of a generic solution for dynamically generated pages unfortunately.