Open ArchTaqi opened 9 years ago
Yeah this depends on whether each individual network provides a callback. As we add more networks, this will become difficult to make consistent as a feature. If you could look into the support other networks have for a post-share callback and post it here, that would help a ton!
As far as I know Facebook
, Twitter
and Linkedin
provides callback if you use their JS APIs. As you have use FB feed API so it was easy for me to put a callback function for facebook but for others you have use their share url. If you use their api instead of Share url it would become easier to putt callback functions for them also.
From this Article http://projs.hackhat.com/how-to-make-a-custom-share-tweet-button-and-know-when-the-user-clicked/
I used this as
var tweetUrlBuilder = function(o){
return [
'https://twitter.com/intent/tweet?tw_p=tweetbutton',
'&url=', encodeURI(o.url),
'&via=', o.via,
'&text=', o.text
].join('');
};
$('.entypo-twitter').on('click', function(){
var url = tweetUrlBuilder({
url : 'http://bit.ly/OChT65',
via : 'ProJavaScript',
text: 'How to make a custom share tweet button and know when the user tweeted'
});
window.open(url, 'Tweet', 'height=500,width=700');
})
// Called by the Twitter, many times during it's
// life-cycle. We only want to know when the user
// has tweeted, so the following filters are required.
var callback = function(e){
if(e && e.data){
var data;
try{
data = JSON.parse(e.data);
}catch(e){
// Don't care.
}
if(data && data.params && data.params.indexOf('tweet') > -1){
alert('Thanks for the tweet!');
}
}
};
window.addEventListener ? window.addEventListener("message", callback, !1) : window.attachEvent("onmessage", callback)
Now, need to call this function in your Share.prototype.network_twitter
Hey, @TaqiOfficial - we've been looking into this. If you find anymore like the twitter one, let us know! Otherwise in v1.0.0 we're going to have the option to load a platforms JS lib for this and other functionality
I am also working on it, As I have no prior exp. contributing to git repo via pull, merge etc. so i will share my code here, else I will contribute to this repo.
Hi, I tried this, it does not work, I also tried the original stuff on JSFIlldel, not either
HI @taqiofficial the above script does not work
any update on this? I wanted to get a successful callback , so I can offer a user discount code
how we can get response after sharing content from Facebook in asp.net....:) that response is null or not. Please send me suggestions
I want to get callback if the page has been successfully been shared or not. I have used
before
andafter
but it only functions when the sharing windows opens, not when exactly the contents has been shared.Managed to get callback for facebook, but unable for twitter and others