How to check user has liked(+1) google+ button on

2019-07-18 03:55发布

问题:

How to get like status of google+ button on website or url? I am using PHP.

回答1:

Unfortunately this isn't quite possible. Neither the REST API nor the PlusOne button itselfs provides a method to check whether a user has +1'd the page or not. Furthermore, if you're using PHP, the user would have to authenticate himself first (using OAuth), so that's probably not what you want, anyway.

What you can do, however, is using Javascript to catch actions of the current visitor. You can specify a callback parameter when creating the +1 button which will be called everytime when the user clicks on the +1 button (source).

While this approach doesn't provide you any information about who the user is (in terms of Google+ user), you could track his actions on your server using a cookie or something else. Or, if that's sufficient, just use the information for the duration of his stay.



回答2:

if you are trying to get the statistics of your website's +1s, google's webmaster tools will provide the data.



回答3:

YOu can get this from +1 metric menu in left panel in webmaster tools