Add Total Shares From Four Pages


Quick edits to replace links.

I would like to add the total shares of 4 pages together. Someone made this for me and I cleaned it up a bit with some help. All works but now I want to add the total likes for four pages and I’m hoping I could get a little help here?

function fbs_click() {
	u = location.href;
	t = document.title;'' + encodeURIComponent(u) + '&t=' + encodeURIComponent(t), 'sharer', 'toolbar=0,status=0,width=626,height=436');
	return false;

var Gal_All = "Original URL here";
var Gal_S_1 = "Second URL here";
var Gal_S_2 = "Third URL here";
var Gal_S_3 = "Fourth URL here";
var tweets;

function getTwitterCount(url) {
  $.getJSON('' + url + '&callback=?', function(data) {
	tweets = data.count;

var urlBase = 'Original URL is here now as var';

  type: 'GET',
  url: ' + Original URL is here now as var',
  success: function(data) {

var fbshares;
var fbcomments;

function showCount(responseText) {

  // Save the parsed JSON
  var json = responseText;

  // A shares property and value must exist, update
  // the span element with the share count
  fbshares = json.shares;
  fbcomments = json.comments;
  if (fbcomments) {
	$('#TotalComments').html(fbcomments + ' comments');


function showTotal() {
	if (tweets !== undefined && fbshares !== undefined)
		$('#total-share-count').html(tweets + fbshares);

Obviously you can ignore the Facebook adding four pages due to where I’m asking for help - I believe I can do this part but I don’t quite understand the Twitter part…

Best Regards,


I’m afraid this is not a supported / available API endpoint, so even if this worked for a while, the chances are that your IP and script would be blocked before long.

Best approach to get total shares for individual URL?

Thank you for your your reply :smile:

Sometimes I get a reply saying how bad my code is, well this is some really bad news!

I don’t suppose you would have the time to lend a hand or forward to a straight forward step-by-step guide?