javascript - Gigya Socialize ShareBar API get provider name on click providers -
i using gigya socialize sharebar api in project. want provider name on provider click in sharing popup.
i can't use onsenddone function ref in project. there callback provider name on click it?
here gigya documention link: http://developers.gigya.com/display/gd/socialize.showsharebarui+js
you can use onsharebuttonclicked event name of provider. note not work native login buttons (google/facebook on mobile) if doing on web should need. attaching working example (requires gigya api key on page).
// create div widget (or use existing div on 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 useraction sharing var gigyashareaction = new gigya.socialize.useraction(); gigyashareaction.linkback = 'https://demo.gigya.com'; gigyashareaction.usermessage = 'check out!'; // // define sharebuttons var sharebuttons = 'facebook, twitter, linkedin, messenger, share'; // // define 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 share bar plugin: gigya.socialize.showsharebarui(shareparams);
this log console name of provider clicked, can alternatively create var , send somewhere, or fire google analytics event data.
Comments
Post a Comment