Widget Callbacks

 

Callbacks provide a convenient method for sites to be notified when the ShareThis widget is used. The widget will call a pre-registered JavaScript function when a sharing event occurs. The function receives data about the share event.


Example: The example below illustrates callback function that pops


<script type="text/javascript">
function myCallbackFunction (event,service)
{
     alert
("event called is:"+event); //the event type. Only "click" is supported.
     alert
("service called is:"+service); //the service shared by user. e.g. facebook
}

stLight
.subscribe("click",myCallbackFunction); //register the callback function with sharethis

</script>

The function you define will take 2 arguments: 1) the event type (only click is supported presently) and 2) the service on which the user shared.