我目前正在使用 Gigya wordpress 插件在 Wordpress 中实现共享栏,但我需要能够跟踪共享事件并且我没有使用 Google Analytic。知道如何在此插件中添加回调以启用跟踪吗?我需要使用回调的原因是因为 google plus share 在 iframe 中,我无法绑定 click 事件。
我已阅读此文档,但这是使用与 wordpress 插件不同的 Gigya api。我试图使用这段代码,但它什么也没做。
// onSendDone - event handler method, called after Gigya finishes the sharing process
// Reports the event to your Analytics provider
function onSendDone(event) {
console.log('click');
if(event.providers) {
var providers = event.providers.split(",");
for(i = 0; i < providers.length; i++) {
var provider = providers[i];
// Report the event to your Analytics provider
//waTrackPlusOne_vote(provider);
console.log('pass in ' + provider);
}
}
}
var ua = new gigya.services.socialize.UserAction();
var currentURL = window.location.href;
var $currentTitle = $j('title').text();
ua.setLinkBack(currentURL);
ua.setTitle($currentTitle);
// Define Share Bar plugin's Parameters
var shareBarParams ={
userAction:ua,
shareButtons: "google-plusone",
containerID: '.gig-button-container-google-plusone', // location of the Share Bar plugin,
onSendDone: onSendDone // onSendDone method is called after Gigya finishes the publishing process.
}
// Load Share Bar plugin
gigya.services.socialize.showShareBarUI(shareBarParams);