
Many websites will show Social Share buttons for Facebook, Twitter, Google+, LinkedIn, Pinterest, to name a few among many other social networks . These buttons generally show the number of times that page was shared on that network as well as a way to click the button and share the page with their social friends and followers.
This is all good and great but sometimes you might want to go a step above and beyond the standard buttons that everyone uses! That is where this article comes into use. I will give you the key API endpoint to access and get your own social network counts so that you can use it in your own custom solution.
What is the Social Count used for?
Below I will show you how you can get the social count numbers from each of the social networks on your own without including their JavaScript snippets on your site. What this means is you can build your own social share buttons with real counts and all like the real ones except you can style them and do whatever you like with them.
This is great and I will show you a few examples of other sites that have built their own share buttons using this technique to get the social count numbers.
The Next Web has built a really cool and useful share widget/box using custom social count numbers…

The Social News site Mashable.com has built there own custom share buttons and use the share count extensively on every page…

Another example of Mashable.com showing a hover state and non-hover state.

Alternatives to building your own Social Count Buttons?
If you are not inclined to building your own unique social share widget, you can use this jQuery plugin named Sharrre. It will allow you to easily build custom share buttons and style them how you like without doing all the custom coding.
Another alternative that I used on CodeDevelopr is called Socialite. What Socialite does not style the social buttons how you want, but instead it allows you to include one JavaScript file instead of all the seperate social libraries. The best feature is you can have the social network libraries only load when the social widget is hovered. It does this by showing a dummy image on page load. Once you hover that fake social buttons image, the JavaScript replaces it with the real social buttons!
This allows for faster page loads as all the social network libraries are not retrieved on page load. You can see a live demo of it in action on my social share widget at the edn of this article. Please do share with your friends
Build you own Custom Social Buttons with Count
Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.
Get URL:
https://cdn.api.twitter.com/1/urls/count.json?url=http://www.codedevelopr.com
{
"count":528,
"url":"http://www.codedevelopr.com/"
}
Facebook Number of URL Shares
Get URL:
https://graph.facebook.com/?id=http://www.codedevelopr.com
{
"id": "http://www.codedevelopr.com",
"shares": 61
}
PRO TIP: You can send in multiple URL’s seperated by commas to get multiple results in 1 query. https://graph.facebook.com/?ids=https://www.google.com,https://www.apple.com,https://www.microsoft.com
{
"https://www.google.com": {
"id": "https://www.google.com",
"shares": 6668703,
"comments": 2
},
"https://www.apple.com": {
"id": "https://www.apple.com",
"shares": 129127
},
"https://www.microsoft.com": {
"id": "https://www.microsoft.com",
"shares": 5323
}
}
Facebook Number of Likes for a Page
Note: Like our Facebook page to motivate us and receive live updates for web developers
Get URL:
https://graph.facebook.com/codedevelopr
{
"about": "CodeDevelopr.com is a blog for Software & Web Developers and Designers. https://www.CodeDevelopr.com",
"category": "Computers/internet website",
"description": "Join our email list for our newsletter https://bit.ly/Hj9f3G\n\nCodeDevelopr.com is a Web Developer blog with articles about PHP, Python, Ruby & Rails, Javascript, jQuery, CSS, HTML, Web Design, Web Development, WordPress dev, Databases, MySQL, Programming, and a lot of other related topics\n",
"is_published": true,
"release_date": "Jan 2012",
"talking_about_count": 126,
"username": "codedevelopr",
"website": "https://www.CodeDevelopr.com",
"were_here_count": 0,
"id": "280686918634735",
"name": "CodeDevelopr",
"link": "https://www.facebook.com/codedevelopr",
"likes": 470,
"cover": {
"cover_id": 348544688515624,
"source": "https://sphotos-g.ak.fbcdn.net/hphotos-ak-frc1/s720x720/485770_348544688515624_818947481_n.jpg",
"offset_y": 0,
"offset_x": 0
}
}
Google Plus Share Count
Get URL:
https://clients6.google.com/rpc?key=YOUR_API_KEY
[{
"method":"pos.plusones.get",
"id":"p",
"params":{
"nolog":true,
"id":"http://www.codedevelopr.com/",
"source":"widget",
"userId":"@viewer",
"groupId":"@self"
},
"jsonrpc":"2.0",
"key":"p",
"apiVersion":"v1"
}]
[{
"result": {
"kind": "pos#plusones",
"id": "http://www.codedevelopr.com/",
"isSetByViewer": false,
"metadata": {
"type": "URL",
"globalCounts": {
"count": 3097.0
}
}
} ,
"id": "p"
}]
Pinterest Share Count
Get URL:
https://api.pinterest.com/v1/urls/count.json?callback=&url=http://www.codedevelopr.com
({
"count": 5345,
"url": "http://www.codedevelopr.com"
})
LinkedIn Share Count
Get URL:
https://www.linkedin.com/countserv/count/share?url=http://www.codedevelopr.com&format=json
{
"count":17,
"fCnt":"17",
"fCntPlusOne":"18",
"url":"http:\/\/www.codedevelopr.com"
}
StumbledUpon Share Count
Get URL:
https://www.stumbleupon.com/services/1.01/badge.getinfo?url=http://www.codedevelopr.com
{
"result" : {
"url" : "http:\/\/www.codedevelopr.com\/",
"in_index" : true,
"publicid" : "79EJnk",
"views" : "8",
"title" : "CodeDevelopr",
"thumbnail" : "http:\/\/cdn.stumble-upon.com\/mthumb\/703\/113973703.jpg",
"thumbnail_b" : "http:\/\/cdn.stumble-upon.com\/bthumb\/703\/113973703.jpg",
"submit_link" : "http:\/\/www.stumbleupon.com\/submit\/?url=http:\/\/www.codedevelopr.com\/",
"badge_link" : "http:\/\/www.stumbleupon.com\/badge\/?url=http:\/\/www.codedevelopr.com\/",
"info_link" : "http:\/\/www.stumbleupon.com\/url\/www.codedevelopr.com\/"
},
"timestamp" : 1373226466,
"success" : true
}
Buffer App Share Count
Schedule and automate your Social Media posting with Buffer App
Get URL:
https://api.bufferapp.com/1/links/shares.json?url=http://www.codedevelopr.com
{
"shares": 5
}