A
A
Alexey Ivanov2019-10-16 21:31:16
JavaScript
Alexey Ivanov, 2019-10-16 21:31:16

Callback after sharing on social media?

Colleagues, good evening!
I implemented the share block on the site as follows:

<a href="http://vkontakte.ru/share.php?url=site.ru/&title=Title">Вконтакте</a>
<a href="http://www.facebook.com/sharer.php?u=site.ru/&amp;title=Title">Facebook</a>

$('.share a').click(function(e){
      e.preventDefault();
      var url = $(this).attr('href');
      socialopen(url);
      return false;
    });
    function socialopen(url){
      var winpar='width=500,height=400,left=' + ((window.innerWidth - 500)/2) + ',top=' + ((window.innerHeight - 400)/2) ;
      window.open(url,'tvkw',winpar);
    }

Everything works, you can share. BUT! You need to perform actions on the site only when the user actually shares, and not when the sharing window opens (as I did now).
It turns out that I record clicks on the links above in the database, but I need the real number of those who shared. At least those who are currently sharing. If then the entry was deleted from your page, it doesn’t matter anymore.
Is it possible to implement this somehow? Is there another way to share?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question