Can a Facebook object have two URLs? - facebook

I'm creating an "object" via Facebook's Open Graph. Obviously it's assigned a unique URL within my application (e.g. www.myapp.com/something/hash), and I'm injecting the relevant OG meta tags. All fine, and I can then "attach" a "Like" button and Facebook comments.
However those user-created objects are generated from within a Facebook application - which happens to "live" under the same domain (e.g. www.myapp.com/fb) and that object has its own page within the Facebook application (e.g. www.myapp.com/fb/something/hash)
Thus, that same object has effectively two unique URLs. The "external" one is the one I use to identify it, but I also want to have a "Like" button and Facebook comments on that page. It doesn't seem to accept a URL in, say, the fb-like DIV and corresponding og:url meta tag that doesn't match the URl it's housed on.
Is there any way around this - or do I need to do something like a redirect when calling the page from within the Facebook app, or some sort of clever template switching?

Just set the og:url meta tag value for both URLs to the one URL you want to be the “actual” URL of the object.

Related

How to pass the selected image of the visitor using Facebook open graph from the previous page

I have the following problem. I hope some one can help me :)
I have a client who has the following URL
http://www.clientwebsite.com/pageA.html
On the above page client has door images which he allows the visitor to select with a radio button. This page i.e. pageA.html does not have any open graph meta tags on it.
Once the visitor selects the door image on pageA.html he is taken to
http://www.clientwebsite.com/pageB.html
Now the client wants to use open graph meta tags on pageB.html which will pass the URL of pageA.html and the selected door image of the visitor from pageA.html to Facebook.
However this is not working as planned. I have tested this using the Facebook open graph debugger tool and below are my findings
When I pass the og:url meta tag with the URL of pageA.html, Facebook just picks random images from pageA.html and not the one I am passing in the og:image meta tag.
When I omit the og:url meta tag, Facebook picks up the image I am passing in the og:image meta tag but it does not know the URL which I need it to use.
Is there a solution to this?
UPDATE
Here is the URL in question
http://www.jvd.me.uk/share-test3.html
The above is pageB.html. The URL mentioned in the og:url meta tag is pageA.html
Anyone?
I am POSTing the values from pageA.html to pageB.html
Well, Facebook’s scraper doesn’t POST any data to your page B when it requests it, so this approach is of course bound to fail.
It is not possible to have different content based on the user’s choice under the same URL (because when the scraper visits the URL, there is no user to make that choice), so you will need to set up different URLs for your different images. (Using a GET parameter to determine what image to embed would be enough, since different GET parameters make different URLs.)

Can an in-app object only be posted through an opengraph action?

I have a page inside a facebook application that is an opengraph object, when I post a custom action on this object to facebook from my app it is posted right, but when I use a facebook social plugin such as like and like that object it is not posted as that object but instead the object of my facebook application is posted on the timeline... so my question here is Can an in-app object only be posted through an opengraph action?
Nope, new OpenGraph object will be created or data will be updated for existing one once Facebook linter crawl your page to get data this will happen in several cases:
OpenGraph action referencing object published
Like button clicked for specific URL
Link to your page shared on Facebook (in direct way or via any dialogs using link, etc).
Your Like button is probably linked not to your real application URL but to URL within Facebook resulting in different Pages parsed by Facebook on Like Button click and OpenGraph action publishing.
I assume that your like button pointing to Application Tab Canvas or Application Page since links to regular application's canvas parsed correctly by Facebook.
Update:
Seems like the issue with OpenGraph tags is related to the fact that your application returning 404 (Not Found status code) for URL you provided and only returns data for HTTP (but not HTTPS) requests. If error code is returned the cached data is preserved and will not be updated until correct status code returned.
Update 2:
As you've provided real URL it's became clear that you get details for your application instead of actual page because of redirect for all unauthorized users, which lead to inability to rich the real OpenGraph data by Facebook linter.
BTW, You should be aware that every OpenGraph object MUST have publicly accessible URL.

Like count for almost same URL (HTTP, HTTPS)

I set like button on every page of my app. But facebook has two modes o viewing pages: unsecured (HTTP) and secured (HTTSP), so how should I do code href in fb:like to show that the same page on http and https should be count by facebook like as rely SAME page? As far as understand facebook like use URL path as uniq ID, so in fb:like tag I write now http://path or https://path depends on protocol that user use coming on my page, so formally this is two different page and facebook count would different for every page I suppose. How can I make count on http path and https path summiraze and show on both page the same like count? Or may be Facebook alredy solve this problem and I should be worried by this?
And similar question my app is avalable by direct url (mysite/path) so I want likes from such url also count as likes on the same pages but get from path apps.facebook.com/myapp/path. how could I do this? Just now I write in href of like tag path apps.facebook.com/myapp/path even if it accessed by direct URL. Is it corret decision to have solid count of likes get from diffrent entries to app?
Just put the http url of the page regardless of the protocol the user is using.
There's no reason to use https in the fb:like button since it's not being loaded anyway.
Another thing is that in the open graph meta tags, under the url param (og:url) put the http version always.
There's no problem to put the url of the fb canvas page in like button you have in the "direct url", though I think that I would do it the other way around, in the canvas page inside fb I would use the direct url in the like button.

How to achieve dynamic fb actions?

My site has a feed system and when user clicks on any one of those feed snippets (the object), I want the action to be publish in their Facebook news feed. So I'm really confused on how to go about it because as far as I'm aware this is how you post actions on Facebook's JavaScript SDK:
FB.api('/me/namespace:action?object=url','post')
How do you dynamically change the properties of the object? Are there parameters you can send? As far as I'm concerned, Facebook asks you to give pass a URL and it'll grab the <meta> information from that URL?
Am I supposed to perform a GET request with my own server and change the meta tags dynamically. This sounds like more work than it needs to be. For example, what if the feed includes a paragraph of text, it'll be impractical for me to post that as a get request and then urldecode the entire thing.
I'm not sure I totally understand your question, but...
You can dynamically change the tags for facebook og: properties, but you have to do it before the page loads (e.g. using PHP as opposed to javascript). After you send the post using the javascript SDK, facebook crawls the page and looks for the info in the og: meta tags.

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 :)