How to add google+ share callback in Gigya Wordpress plugin? -
i using gigya wordpress plugin implement share bar in wordpress need able track share event , not using google analytic. idea how can add callback in plugin enable tracking? reason need use callback because google plus share in iframe , can't bind click event.
i've read documentation using gigya api different wordpress plug. tried use piece of code , not doing anything.
// onsenddone - event handler method, called after gigya finishes sharing process // reports event analytics provider function onsenddone(event) { console.log('click'); if(event.providers) { var providers = event.providers.split(","); for(i = 0; < providers.length; i++) { var provider = providers[i]; // report event 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 share bar plugin, onsenddone: onsenddone // onsenddone method called after gigya finishes publishing process. } // load share bar plugin gigya.services.socialize.showsharebarui(sharebarparams);
i have faced same problem, here it's how i've done it. @ points when setting gigya share button have declare variable called "shareparams", invoked in gigya.services.socialize.showshareui(shareparams).
just add 'onsenddone' : yourfunctionname shareparams object.
example:
var shareparams = { 'useraction' : {0}, 'onsenddone' : mynamespace.gigyasenddone } gigya.services.socialize.showshareui(shareparams);
when sharing successfully completed, javascript action invoked.
Comments
Post a Comment