我正在使用Google+ interactive post功能,其中发布窗口提供了close
和share
按钮。
如何检测用户点击了哪一个?我在JavaScript API找不到回调 - 是否可以添加自定义?
答案 0 :(得分:1)
目前没有提供您想要的回调类型。该按钮的唯一回调是通过交互式帖子按钮处理用户签名的回调,该按钮在其响应中提供访问令牌和其他信息。收听该回调可以让您知道他们是否授权您的应用,但并不是说他们必须遵循共享。
答案 1 :(得分:0)
使用下面提供的onShare
选项
var deferred = $q.defer();
var options = {
clientid: GooglePlus.getClientId(),
contenturl: data.shareURL,
calltoactionlabel: "SHARE",
calltoactionurl: data.shareURL,
cookiepolicy: "single_host_origin",
prefilltext: "",
callback: function(response){},
onshare: function(response){
if(response.status === 'completed') {
if(response.action && response.action === 'cancelled') {
deferred.reject( response );
} else {
deferred.resolve( response );
}
}
}
};
$window.gapi.interactivepost.render($event.target, options);