Answer the question
In order to leave comments, you need to log in
How to get the number of google+ reposts from a specific page of a site?
Hello.
There is a code for social buttons social like js:
plusone: {
counterUrl: n + "//share.yandex.ru/gpp.xml?url={url}&callback=?",
convertNumber: function(a) {
return parseInt(a.replace(/\D/g, ""), 10)
}
Answer the question
In order to leave comments, you need to log in
Replaced this code with:
var url = "http://www.yoursite-to-be-counted.com";
var data = {
"method":"pos.plusones.get",
"id": url,
"params":{
"nolog":true,
"id": url,
"source":"widget",
"userId":"@viewer",
"groupId":"@self"
},
"jsonrpc":"2.0",
"key":"p",
"apiVersion":"v1"
};
$.ajax({
type: "POST",
url: "https://clients6.google.com/rpc",
processData: true,
contentType: 'application/json',
data: JSON.stringify(data),
success: function(r){
setCount($(".google-plus-count"), r.result.metadata.globalCounts.count);
}
});
var setCount = function($item, count) {
if (count) {
$item.text(count);
}
};
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question