How to check user has liked(+1) google+ button on website or url?

…衆ロ難τιáo~ 提交于 2019-12-10 22:45:56

问题


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



来源:https://stackoverflow.com/questions/9681495/how-to-check-user-has-liked1-google-button-on-website-or-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!