Get Social Network Share Counts

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 Mashabl.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 separate 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 end 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.

Twitter Share Count

Get URL:
https://cdn.api.twitter.com/1/urls/count.json?url=http://www.codedevelopr.com

Returns:

Facebook Number of URL Shares

Get URL:
https://graph.facebook.com/?id=http://www.codedevelopr.com

Returns:

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

Returns Multiple URL’s:

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

Returns:

Google Plus Share Count

Get URL:
https://clients6.google.com/rpc?key=YOUR_API_KEY

POST Body:

Returns:

Pinterest Share Count

Get URL:
https://api.pinterest.com/v1/urls/count.json?callback=&url=http://www.codedevelopr.com

Returns:

LinkedIn Share Count

Get URL:
https://www.linkedin.com/countserv/count/share?url=http://www.codedevelopr.com&format=json

Returns:

StumbledUpon Share Count

Get URL:
https://www.stumbleupon.com/services/1.01/badge.getinfo?url=http://www.codedevelopr.com

Returns:

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

Returns:

Leave a Reply

Your email address will not be published. Required fields are marked *