I got callback after share successfully with Facebook and Twitter.
Is it possible with Linkedin and Google Plus?
Google Plus Share :
href="https://plus.google.com/share?url={URL}"
Linkedin Share :
href="http://www.linkedin.com/shareArticle?mini=true&url={articleUrl}"
Try Linkedin Share widget
Set callback function on onsuccess that fires when share successfully:
<script type="IN/Share+init" data-counter="top" data-url="your share Url" data-onsuccess="tracklinkedin"></script>
On tracklinkedin function:
function tracklinkedin(reponse) {
console.log('linkedin' + reponse);
//do here
}
Google Plus:
<div class="g-plus" data-action="share" data-annotation="top" data-href="your url" data-callback="trackgoogle" ></div>
function trackgoogle(reponse) {
console.log('Google Plus' + reponse.state);
if(reponse.state=='on')
{
$SS.TrackCount('googleplus')
//to do
}}
Just make your own button, with its own callback, and you can ditch the LinkedIn Share Button API SDK, JS Bundle, and inShare plugins. Some of these appear to already be outdated, deprecated, and to have known issues. All you really ought to need is...
https://www.linkedin.com/sharing/share-offsite/?url={url}
Then you can just make any button, using any HTML, CSS, or JavaScript that you like, and hyperlink it to allow sharing of a page. Since it's just a native button, you can control the callback however you like. And make a callback however you'd like...
HTML...
<a id="link" href="https://www.linkedin.com/sharing/share-offsite/?url={url}">Share on LinkedIn</a>
JS...
$('#link').click(function(e) { //callback stuff });
Source: Microsoft LinkedIn Share URL Documentation.
Google is probably a similar situation. If you are interested in a regularly maintained github project that keeps track of these URL formats so you don't have to, check it out! Social Share URLs
Related
I have created a google+ share button ... https://developers.google.com/+/web/share/ ...
It works but it doesnt share any content ... only appear a pop-up share window => I write something into => and this text it share normal ... but not content of my page/ article ... do you know why?
in my body I have this ...
<div class="g-plus" data-action="share" data-annotation="none" data-height="24" data-href="http://localhost/welcome">ddd</div>
There is 2 kind of Google+ share button.You can use a very simple button to share anything.The properties Google+ gets from meta tags and canonical links.
Here is a link: http://www.w3docs.com/learn-javascript/google-share.html
The share button does not support prefilled text. It only supports sharing the current/specified URL.
The interactive posts API does support prefilled text but it also requires more setup to get working.
I am trying to figure out if it's possible to pass in more than a URL to share when using the LinkedIn JS API.
My code is:
IN.UI.Share().params({
url: 'http://www.example.com'
}).place.();
Now I have tried to pass in other params like:
IN.UI.Share().params({
url: 'http://www.example.com',
title: 'A Title',
summary: 'A Small summary'
}).place.();
But that did wot work. It seems to just ignore those extra params.
I know I can do it using the custom share functionality:
http://www.linkedin.com/shareArticle?mini=true&url={articleUrl}&title={articleTitle}&summary={articleSummary}&source={articleSource}
But I want to use the JS API so I can get back a token to verify if it was posted properly. With the shareArticle way it takes about 20-30 seconds to actually verify if it was shared using this: (https://developer.linkedin.com/retrieving-share-counts-custom-buttons).
Unfortunately there is no way to do this. The Linkdin Javascript API and Linkdin Share button relies completely on meta tags to scrape information. Such a Pity.
Just set the og: property tags on the page that you are sharing, that way LinkedIn knows that the title, image, etc., fields, are all actually appropriate and right for the site. You can set them like so...
<meta property='og:title' content='Title of the article"/>
<meta property='og:image' content='//media.example.com/ 1234567.jpg"/>
<meta property='og:description' content='Description that will show in the preview"/>
<meta property='og:url' content='//www.example.com/URL of the article" />
Source: LinkedIn Developer Docs: Making Your Website Shareable on LinkedIn.
Works for my site!
You can always use the LinkedIn Poster Inspector on your site's URL to make sure you did it right!
So i've been trying to get FB Connect working on my site, simply for login and authentication, using the Javascript SDK and following the code at:
https://developers.facebook.com/docs/guides/web/
So the button appears, i click it, a dialog pops up, i click that, presumably my site now has permission to know who i am...
Then what? The guide goes on to saying all the stuff I can access through the Facebook API, all the cool things about permissions, but presumably i need the user's ID or access token or something to get at this stuff. How is that given to me? left as a attribute on one of the elements? Left in a Javascript variable somewhere? Given as an argument to some callback? Thrown high into the heavens for me to receive via satellite downlink?
This is probably incredibly simple, but for the life of me i have not been able to figure it out. Facebook's tutorials have failed me, and so has Google. I want to get this in the Javascript, so I can immediately fill in form-data using the user's Facebook name, put a picture, etc. etc., and presumably send this all back to the server so the server can validate with Facebook that the data is real.
I'm assuming you're using the Login button? https://developers.facebook.com/docs/reference/plugins/login/
If you simply want form info, check out the registration plugin - https://developers.facebook.com/docs/plugins/registration/
However, to answer your question, make an API call to /me. For example:
FB.api('/me', function(user) {
if(user != null) {
// The user object now contains info about the logged in user
}
});
You should subscribe to the auth.login event and wrap the above API call in the successful response, i.e.:
FB.Event.subscribe('auth.login', function() {
// JS to run if when the user logs in, for example, the code snippet above
});
I am logged into my application with linkedin connect, but on logout i logs out of the application and not linkedin. I want user to log out of both linkedin and my application
Facebook have provide an option for the same as below
http://m.facebook.com/logout.php?confirm=1&next={domain url}
IF any one know the same thing with linkedin, It will help me a lot.
Thanks in advance
I have been in trouble for this log out from linkedin for quite sometime but finally found a way out. I have placed my log out link code here:
<a onclick='IN.User.logout(
function redirect()
{
window.location = "logout.php";
}
);'
href="javascript:void(0)">
Log Me Out
</a>
onClick of the logout button, I have called "IN.User.logout" and on its callback, I have given control to the function which redirects to log out script (logout.php in this case) where I log the user out of my system.
I think this should help most of people here.
Does their API allow my Facebook-connected user to add a friend?
No. Adding friends is not possible through the API.
However you can direct users to http://www.facebook.com/addfriend.php?id=[USER UID]
Where [USER UID] is a valid facebook user id.
Good luck!
I spent a great deal of time looking, and finally came accross a very simple solution.
Using the Facebook Javascript API you can do a friend request with:
<script>
FB.ui(
{
method: 'friends.add',
id: fbid // assuming you set this variable previously...
},
function(param){
console.log(param);
// If they cancel params will show:
// {action:false, ...}
// and if they send the friend request it'll have:
// {action:true, ...}
// and if they closed the pop-up window then:
// param is undefined
}
);
</script>
The callback script can then simply performs an ajax call to your server where
you save info about the action, if needed.
You can test this by using the javascript console app on Facebook:
http://developers.facebook.com/tools/console
Paste in the script above, including the tags, or click the "Examples"
button on the bottom of the text area and find the "fb.ui — friends.add" example.
https://developers.facebook.com/docs/reference/dialogs/friends/
Here is a Wiki list of the API methods available to you http://wiki.developers.facebook.com/index.php/API#Administrative_Methods
Doesn't look like you can add friends via the API. Note the iPhone facebook app also doesn't have an add friends function, it was written via the API, so that lends more weight to the idea that you can't