Amit Dhamu

Software Engineer

Social Media Share Counts

var url = 'http://www.google.com';

// Twitter
$.getJSON('https://cdn.api.twitter.com/1/urls/count.json?url=' + url + '&callback=?', function(result) {
    console.log(result.count);
});

// Facebook
$.getJSON('https://graph.facebook.com/' + url, function(result) {
    console.log(result.shares);
});

// Pinterest
$.getJSON('https://api.pinterest.com/v1/urls/count.json?callback=&url=' + url, function(result) {
    console.log(result.count);
});

// StumbleUpon
$.getJSON('https://www.stumbleupon.com/services/1.01/badge.getinfo?url=' + url, function(result) {
    console.log(result.result.views);
});

You can find more information and details about the result objects on this helpful Github Gist.


 social media / share count

Solr - Delete By QuerySearch Git Commit History

Show Comments

Made with by Amit Dhamu.
© MMXX. All rights reserved.