0

I am currently using Gigya wordpress plugin to implement the share bar in Wordpress but I need to be able to track the share event and I am not using Google Analytic. Any idea how I can add a callback in this plugin to enable tracking? The reason I need to use a callback is because google plus share is in an iframe and I can't bind the click event.

I've read this documentation but this is using the Gigya api which is different than the wordpress plug. I tried to use this piece of code and it is not doing anything.

// 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);

2 Answers 2

3

I have just faced the same problem, here it's how I've done it. At some points when setting up the Gigya Share Button you will have to declare a variable called "shareParams", invoked in gigya.services.socialize.showShareUI(shareParams).

Just add 'onSendDone' : yourFunctionName to the shareParams object.

Example:

var shareParams = {
    'userAction' : {0},
    'onSendDone' : myNamespace.GigyaSendDone
}

gigya.services.socialize.showShareUI(shareParams);

When the sharing is successfully completed, this Javascript action will be invoked.

2
  • If you are using the Javascript APIs, it definitely will. Aug 20, 2013 at 20:44
  • Yes, silly me. The js api is indeed in the plugin. Found it and going to work on it. Thanks.
    – Xzigraz
    Aug 22, 2013 at 22:56
0

So thanks to Emanuele Ciriachi, I found the js api code in the plugin. Once modified it, I think this will resolve my issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.