I'm using the AddThis widget to enable the sharing of site content towards Twitter, Facebook and Google+. I have signed in users on my website and am looking into making an association between the signed user and his sharing behavior.
For this I need to listen to the callback of the Addthis widget, here's the direct example from their website:
function shareEventHandler(evt) {
if (evt.type == 'addthis.menu.share') {
alert(typeof(evt.data)); // evt.data is an object hash containing all event data
alert(evt.data.service); // evt.data.service is specific to the "addthis.menu.share" event
}
}
// Listen for the share event
addthis.addEventListener('addthis.menu.share', shareEventHandler);
The problem with this event is that it is triggered before actually sharing something. For example, a user clicks the "Tweet" buttton, this script is triggered, the Tweet dialog is launched, and the user either moves forward or cancels the sharing in that dialog.
Ideally, the event handler is triggered once the actual sharing was done successfully, and not when the user cancels it. It doesn't seem possible from the official documentation, but I wanted to try nevertheless if anyone has a creative workaround?
possible workaround:
i'm assuming that post sharing the addthis content box is altered...do a check for this element (probably a class(es)) to ensure sharing success
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With