artuska
artuska

Reputation: 874

Catch share result in popup

How to detect sharing result if I'm not using social network's Javascript SDK? All social network's stuff (authorization, sharing, etc.) happens in popups on my domain.

var popup = window.open('/api/share/' + service + '/page/123', '', 'top=' + top + ', left=' + left + ', width=400, height=500');

When sharing popup opens user can press Facebook's (or any other social service) share button and popup closes. But, user also can just close a popup without sharing. So, how do I know user shared or user closed a popup?

If I use social network's Javascript SDK, eg. Facebook Javascript SDK, it is pretty simple:

$('#shareButton').click(function() {
    FB.ui({
        method: 'feed',
        link: 'https://developers.facebook.com/docs/dialogs/',
        caption: 'An example caption',
    }, function(response) {
        if (response === null) {
            console.log('user just closed a popup');
        } else {
            console.log('user really shared a post ' + response.post_id);
        }
    });
});

I'm using Facebook, Google+, Twitter and Vkontakte social networks on my web page and I really do not want to include four Javascript SDK on my web page (Twitter does not even have JS SDK actually).

Upvotes: 0

Views: 206

Answers (1)

andyrandy
andyrandy

Reputation: 73984

It´s not really a direct answer, and i don´t work for that platform, but i suggest using something like this: http://www.sharedcount.com/

In one API call, you get likes/shares for all important platforms. It´s cached, so if you do the same call twice in a short time it will be very fast the second time.

The free plan includes 10.000 calls per day.

Upvotes: 1

Related Questions