Javascript Gigya社交ShareBar API在单击提供程序时获取提供程序名称

Javascript Gigya社交ShareBar API在单击提供程序时获取提供程序名称,javascript,jquery,gigya,Javascript,Jquery,Gigya,我正在我的项目中使用Gigya Socialize ShareBar API。我想在任何提供商单击共享弹出窗口中获取提供商名称 我无法在项目中使用onSendDone函数ref。是否有回调来获取单击时的提供程序名称 以下是Gigya文档链接: 您还可以使用onShareButtonClicked事件来处理提供者的名称。请注意,这对本地登录按钮(移动设备上的Google/Facebook)不起作用,但如果您在web上执行此操作,则应满足您的需要。我附上一个工作示例(需要在页面上有一个Gigya A

我正在我的项目中使用Gigya Socialize ShareBar API。我想在任何提供商单击共享弹出窗口中获取提供商名称

我无法在项目中使用onSendDone函数ref。是否有回调来获取单击时的提供程序名称

以下是Gigya文档链接:


您还可以使用onShareButtonClicked事件来处理提供者的名称。请注意,这对本地登录按钮(移动设备上的Google/Facebook)不起作用,但如果您在web上执行此操作,则应满足您的需要。我附上一个工作示例(需要在页面上有一个Gigya API密钥)

这将把被点击的提供者的名字记录到控制台,你也可以创建一个var,然后将它发送到某个地方,或者用数据触发一个Google分析事件

// Create a div for the widget (or use an existing div on your page)
var newShareDiv = document.createElement('div');
newShareDiv.id='ShareDiv';
newShareDiv.setAttribute('style', 'position: absolute; z-index: 1000; margin: 0px auto; margin-top: 10px !important; width: 200px; height: 20px; background-color: yellow; border: 2 px solid red;')
document.body.appendChild(newShareDiv);
//
// Create the UserAction for sharing
var gigyaShareAction = new gigya.socialize.UserAction();
gigyaShareAction.linkBack = 'https://demo.gigya.com';
gigyaShareAction.userMessage = 'Check this out!';
//
// Define shareButtons
var shareButtons = 'Facebook, Twitter, LinkedIn, Messenger, share';
//
// Define the Share Bar Plugin's params object
var shareParams = {
    userAction: gigyaShareAction,
    showCounts: 'none',
    containerID: 'ShareDiv',
    scope: 'both',
    privacy: 'public',
    iconsOnly: true,
    layout: 'horizontal',
    noButtonBorders: false,
    operationMode: 'simpleShare',
    onShareButtonClicked : function(e) {
        console.log(e.shareItem.provider);
    },
    shareButtons: shareButtons // list of providers 
};
//
// Load the Share Bar Plugin:
gigya.socialize.showShareBarUI(shareParams);