To make hshare more powerful, we also provides customized statistics feature.
The API is shown as below:
loadStat
URL: [customized]?url=[url]
Method: GET
Response Type: JSON
Response data:
name | type | meaning |
---|---|---|
stat | Integer | the shared times of current page |
Example Request:
GET https://www.heavenduke.com/hshare/?url=www.baidu.com
Response:
{
"stat": 2333
}
updateStat
URL: [customized]
Method: POST
Request Type: JSON
Request Data:
name | type | meaning |
---|---|---|
name | String | name of the clicked platform |
url | String | current page's url |
Response Type: JSON
Response data:
name | type | meaning |
---|---|---|
stat | Integer | the shared times of current page |
Example Request:
GET https://www.heavenduke.com/hshare/?url=www.baidu.com
{
"name": "baidu",
"url": "www.baidu.com"
}
Response:
{
"stat": 2333
}
The url of the two API is configurable. To enable statistics feature, you should specify both url. Here is an example:
$("#container").hshare({
stat: {
loadUrl: "https://www.heavenduke.com/hshare",
updateUrl: "https://www.heavenduke.com/hshare"
}
});