When should use use "FB.Connect.showShareDialog" instead of "FB.Connect.streamPublish"? - facebook

It looks like they do virtually the same thing for simple posts. Do they show up in different place in Facebook? Any ideas?

Using FB.Connect.streamPublish you are allowed to specify attachments (image, flash, mp3), action_links, and a user_message_prompt. The posting to their Profile may be more engaging if you go this route.
The FB.Connect.showShareDialog is mainly just a url that you pass in. Facebook loads that url to get the page title, and see if there are suitable thumbnail images specified on that page.
The main advantage of showShareDialog is that you can ask the users to click on "Send as Message instead" to send the link to specific friends. The default behavior is to "Post to Profile instead".
For basic uses, the two calls can be very similar, but they each have their own distinct capabilities too. I'm finding that I have a need for both in different cases.

Related

Multiple images through Facebook sharer.php url

Does anyone know how to give the user the option to choose between multiple images when sharing a page on Facebook?
I've used an url like the one below in the past. The images param would be
p[images][0]=...&p[images][1]=...
etc. However, it seems that this doesn't work anymore. The user sees the arrows to select the next or previous image with but there is only one image to choose from.
Web page
http://occasions.dvangorkum.nl/Land-Rover/Range-Rover-Sport-2.7-/TdV6-HSE-Navigatie-PDC-Climate-Xenon-Luchtvering--1606304/1603/1/11/details.aspx?zoek=&so=gallerij
URL:
https://www.facebook.com/sharer/sharer.php?s=100&p[url]=http%3A%2F%2Foccasions.dvangorkum.nl%2FLand-Rover%2FRange-Rover-Sport-2.7-%2FTdV6-HSE-Navigatie-PDC-Climate-Xenon-Luchtvering--1606304%2F1603%2F1%2F11%2Fdetails.aspx%3Fzoek%3D&p[images][0]=http%3A%2F%2Fimages.autodealers.nl%2F640%2F1606304_1.jpg&p[images][1]=http%3A%2F%2Fimages.autodealers.nl%2F640%2F1606304_2.jpg&p[images][2]=http%3A%2F%2Fimages.autodealers.nl%2F640%2F1606304_3.jpg&p[images][3]=http%3A%2F%2Fimages.autodealers.nl%2F640%2F1606304_4.jpg&p[images][4]=http%3A%2F%2Fimages.autodealers.nl%2F640%2F1606304_5.jpg&p[images][5]=http%3A%2F%2Fimages.autodealers.nl%2F640%2F1606304_6.jpg&p[images][6]=http%3A%2F%2Fimages.autodealers.nl%2F640%2F1606304_7.jpg&p[images][7]=http%3A%2F%2Fimages.autodealers.nl%2F640%2F1606304_8.jpg&p[images][8]=http%3A%2F%2Fimages.autodealers.nl%2F640%2F1606304_9.jpg&p[images][9]=http%3A%2F%2Fimages.autodealers.nl%2F640%2F1606304_10.jpg&p[images][10]=http%3A%2F%2Fimages.autodealers.nl%2F640%2F1606304_11.jpg&p[images][11]=http%3A%2F%2Fimages.autodealers.nl%2F640%2F1606304_12.jpg&p[title]=++++Land-Rover%C2%A0Range+Rover+Sport+2.7+%C2%A0TdV6+HSE+Navigatie+PDC+Climate+Xenon+Luchtvering+&p[summary]=Occasion+te+koop+aangeboden+Land-Rover+Range+Rover+Sport+2.7++TdV6+HSE+Navigatie+PDC+Climate+Xenon+Luchtvering++uit+2007%2C+187618+km%2C+Diesel%2C+SUV%2C+Automaat%2C+Grijs&so=gallerij
However, it seems that this doesn't work anymore.
Yes, the Share dialog does not accept these parameters any more after a recent change, but will now get all its info about the shared link from the Open Graph meta information embedded in the shared document.
So if you want multiple images the user can chose from, you have to put multiple og:image meta tags into your document. (Be aware that Facebook seems to offer no more than three images to chose from any more, so putting more images in there is pointless.)
For documentation on Open Graph meta information, see https://developers.facebook.com/docs/opengraph/using-objects/#creating and http://ogp.me/

How to get Facebook share link owner?

Previously Facebook allowed to share anything you want, now we should use feed and send dialogs. When we are using dialogs to share link to friend, then link should be validated though Facebook (as I remember even without sub domains).
Is there a way to add parameter to link like ?ref_id=any_unique_value or other ways, later sever to determine, with whom the link belongs to (and whom to reward).
You should be able to add a query string (?ref_id=abcd) to the link parameter of a FB.ui "send".
The FB.ui can be a bit finicky with what links it accepts. Please see my answer here for more info on valid links.

"Top Posts" depending on facebook likes

I have an idea to create a "top posts" feature to my website, which creates the "top" list depending on how many likes and shares that a post have on facebook.
Users may see how many likes an post has received so far since they only have to ask for a single, defined url. However, the website itself has to be able to query all the links that are tied to itself (which have a predefined url template like website.com/[post-id]) to create the "top" list. Is it possible to do something similar (or achieve the same result in a different way)?
Any ideas on a real workflow about something like this will be appreciated!
this seems like a little but interesting project. I don't know if there is a feature that could get that directly in the way you want, but i did something similar.
First you have the Graph API, with that you can get the Posts of a user using feed, with that every post is telling you how many likes does it have which you can get with POST_ID/likes.
Then you'll have to check for changes in the post periodically comparing its created_time and updated_time.
This could seem very hard, because you have a lot of posts and you have to check them all for updates, but you can use batch_requests so you can check them all at once.
I have made a bookmarklet which shows top posts in the Facebook News Feed as well as Google+, Twitter and Instagram Profiles.
Just add a new bookmark in your bookmarks bar and replace its URL with the following code and save it, then go to the social network website and run it:
javascript:(function(){var s=document.createElement('script');s.src='https://niutech.github.io/topnewsfeed/topnewsfeed.min.js';document.body.appendChild(s);})()
The source code is available on GitHub.

Multiple Facebook share button/link on the same page refering different TITLE & LINK

I need to create a "contest" page where user will be asked to submit picture.
After that, they should be able to share their picture on FB, Twitter, G+, Pinterest, etc for other people to come and vote.
I want the page to be displayed as a jQuery gallery and whenever people select a thumbnail, the bigger picture open with the associated vote and "share" button.
When a user share an image, I want a specific TITLE & URL associated with that particular image... something like "http://www.mysite.com/contest.html#picture1"... or "http://www.mysite.com/contest.html#picture2"
How is this possible if I only have one page?
I wouldn't have problem if I could use the old "facebook.com/sharer.php" with parameters... but it seems that the Open Graph Protocol is "overiding" the sharer.php parameters....
Works fine with Twitter and Pinterest... I might have the same problem with Google+.
Excuse my bad english, thanks!
Well, set up a (“dummy”) page for each picture, and fill it with the appropriate OG tags … and have your users like that. And then put a JS redirect into that page, so that users following the link when it’s shared on Facebook will get to the “real” address you want them to end up at.
(Btw., IMHO this is what happens too often these days when people think doing everything client-side and client-side only is so “fancy” and that a “good” and “modern” site requires all that AJAX/one-page-only nonsense instead of a real good and working URL structure, and then are not able to handle all that this implies properly …)

Share bought products from order on buyer's Facebook wall

The company I'm currently working for wants to create a button that lets people share their order on Facebook after they've paid, but with the deprecation of the "Share" button I don't really know how to do it.
The "Like" button does not seem fit for this. Any ideas, anyone?
There are a few ways to go about this.
You can use the standard sharer. This is good for one-off sharing or in cases where you don't have control or don't want to control how the share is rendered and you want Facebook to handle it.
http://www.facebook.com/sharer.php?u=<url to share>&t=<title of content>
It won't require you to have an app ID but you also won't get a nice control panel for your applications sharing history/insights. You can query and get some information about the URL your sharing though by looking through the open graph.
I.E
https://graph.facebook.com/?ids=http%3A%2F%2Fwww.cnn.com
https://graph.facebook.com/comments/?ids=http%3A%2F%2Fwww.cnn.com
You can set the URL and Title of the content. The sharer will then look at the metadata on the webpage your sharing to determine the contents of the share. More below.
You can also use the Feed dialog. Which comes with more customization options. The Feed dialog is the best option if your integrating sharing as an integral part of the application. I think at minimum you need to include the app_id,redirect_uri and link property. Look through the properties here. You will need an app ID to use this feed dialog and if your using the JS api you need to authenticate the user too. You can also invoke the dialog directly through a direct url where you don't need to pre-authenticate the user.
With either sharing method, you may wish to include custom open graph metatags on your webpage. This way you can influence how the Facebook scraper makes your share. You can set some default (pre-accepted by Facebook) open graph metatags on your page. Or you can create your own set now in the dashboard. In the Open Graph dashboard on Facebook you can customize how Facebook is supposed to read and interact with your metatags.
You can debug your pages open graph metatags by passing your URL through the debugger.
I.E
http://developers.facebook.com/tools/debug/og/object?q=www.cnn.com
This will give you, for example, JSON or an HTML representation of how FB sees the page.