There are buttons "Share" VKontakte, Twitter and Facebook.

When the user clicks, a dialog box opens and clicks Share. I need to know the answer - did the user share or not? The API did not find anything like it.

Who can offer? How can I get an answer? If it were possible to frame the dialog box, then it was possible to handle the event of clicking on the Share button, but alas.

You can still without dialog boxes, but I do not know how to do it.

    2 answers 2

    In the HashCode with the API it seems - not very, found a solution. To find out the answer, you need to connect

    VK

    <script type="text/javascript" src="http://userapi.com/js/api/openapi.js?49"></script> <script type="text/javascript"> VK.init({ apiId: идентификатор_приложения, onlyWidgets: true }); </script> 

    Fb

     <script src="//connect.facebook.net/en_US/all.js"></script> 

    Twitter

     <script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> 

    Next for VK

     VK.Observer.subscribe('widgets.like.shared', function(likeCount) { //если пользователь опубликовал ваш пост }); 

    For FB

     FB.Event.subscribe('edge.create', function(opt_target) { //если нажали на кнопку "рекомендовать" }); 

    For tw

     trackTwitterHandler_ = function (intent_event) { var opt_target; if (intent_event && intent_event.type == 'tweet' || intent_event.type == 'click') { var socialAction = intent_event.type + ((intent_event.type == 'click') ? '-' + intent_event.region : ''); //тип нажатия //ну, как пример, проверка на то, твиттнули ли if (socialAction == 'tweet') { //если титнули } //еще можно обрабатывать нажатие по числу твиттов и тд}}; intent_handler = function (intent_event) { trackTwitterHandler_(intent_event); }; twttr.events.bind('click', intent_handler); twttr.events.bind('tweet', intent_handler); } } 

      Personally, this code did not work for me:

       VK.Observer.subscribe('widgets.like.shared', function(likeCount) { //если пользователь опубликовал ваш пост somefunction() }); 

      I did this:

       var somefunction() {}; $('#vkshare0 a').click(function(){ VK.Observer.publish("widgets.like.shared",8); })