Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to listen to an AddThis post share event?

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?

like image 657
Fer Avatar asked Apr 27 '12 07:04

Fer


1 Answers

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

like image 106
albert Avatar answered Sep 24 '22 18:09

albert