How to count total shares from Facebook, Twitter, Google+, etc?

hoangvu

New member
Joined
Jun 6, 2012
Messages
1,835
Points
0
Hi everyone,

Is there any ways how to count total shares from Facebook, Twitter, Google+, etc?

I want to show total share on my site like some sites I saw through internet.

Any tips?
 

yestyle

New member
Joined
Jul 1, 2012
Messages
189
Points
0
Hello Kelly,

To show total shares from social networks on your site, the first you need to get numbers of shares on each social like Facebook, Google+, Twitter..etc.

Twitter

GET URL:
Code:
http://cdn.api.twitter.com/1/urls/count.json?url=https://www.webmastersun.com
Returns:
Code:
{
    "count":254,
    "url":"https://www.webmastersun.com/"
}
Facebook

GET URL:
Code:
http://graph.facebook.com/?id=https://www.webmastersun.com
Returns:
Code:
{
   "id": "https://www.webmastersun.com",
   "shares": 56
}
LinkedIn

GET URL:
Code:
http://www.linkedin.com/countserv/count/share?url=https://www.webmastersun.com&format=json
Returns:
Code:
{"count":23,"fCnt":"23","fCntPlusOne":"24","url":"http:\/\/www.webmastersun.com"}
Google Plus

POST URL:
Code:
https://clients6.google.com/rpc?key=YOUR_API_KEY
POST body:
Code:
[{
    "method":"pos.plusones.get",
    "id":"p",
    "params":{
        "nolog":true,
        "id":"https://www.webmastersun.com/",
        "source":"widget",
        "userId":"@viewer",
        "groupId":"@self"
        },
    "jsonrpc":"2.0",
    "key":"p",
    "apiVersion":"v1"
}]
Returns:
Code:
[{
    "result": { 
        "kind": "pos#plusones", 
        "id": "https://www.webmastersun.com/", 
        "isSetByViewer": false, 
        "metadata": {
            "type": "URL", 
            "globalCounts": {
                "count": 2204
            }
        }
    } ,
    "id": "p"
}]
StumbledUpon

GET URL:
Code:
http://www.stumbleupon.com/services/1.01/badge.getinfo?url=https://www.webmastersun.com
Result:
Code:
{"result":{"url":"http:\/\/www.webmastersun.com\/","in_index":true,"publicid":"1Ya7Va","views":"1","title":"Webmaster Forum, SEO & Internet Marketing Forums","thumbnail":"http:\/\/cdn.stumble-upon.com\/mthumb\/401\/138742401.jpg","thumbnail_b":"http:\/\/cdn.stumble-upon.com\/bthumb\/401\/138742401.jpg","submit_link":"http:\/\/www.stumbleupon.com\/submit\/?url=http:\/\/www.webmastersun.com\/","badge_link":"http:\/\/www.stumbleupon.com\/badge\/?url=http:\/\/www.webmastersun.com\/","info_link":"http:\/\/www.stumbleupon.com\/url\/www.webmastersun.com\/"},"timestamp":1395115711,"success":true}
After that, you need to get the result to show on your webpage by PHP, javascript or some thing else.

I suggest you should use tools via Google to check for fast and easy way.

Hope it helps!
 

BloodMaster

New member
Joined
Aug 5, 2013
Messages
346
Points
0
Hey Yestyle, This is a great and like it. You describe it as simple as you can buddy.
 
  • Like
Reactions: yestyle

yestyle

New member
Joined
Jul 1, 2012
Messages
189
Points
0
yestyle
You are welcome!, It's only an explanation for number of shares that we can get from social networks. I can say that to get number of shares then having more ways to do that.
 

hoangvu

New member
Joined
Jun 6, 2012
Messages
1,835
Points
0
Wonderful tips, Yestyle! I tried your code with my site and I knew number of social shares on my site without using any tools. :thumb:
 
Older threads
Newer threads
Replies
5
Views
3,466
Replies
2
Views
3,654
Replies
2
Views
2,878
Replies
9
Views
4,923
Recommended threads
Replies
4
Views
2,945
Replies
0
Views
2,344
Replies
4
Views
1,799

Referral contests

Referral link for :

Sponsors

Popular tags

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top