Reputation: 446
I have a website built in Drupal and I have both the fbconnect module and the facebookshare module. I want to figure out the easiest way to confirm that a user in fact shared the piece of content. I've seen a couple threads but I still seem unable to figure it out. Can anyone lend a hand? I've been at this for a few days.
Upvotes: 3
Views: 6243
Reputation: 47966
If you include the Facebook Javascript SDK in your pages, then you can initiate facebook's share dialog and be able to recieve a callback once the dialog closes.
Here is an example taken from the FB.ui()
documentation :
FB.ui(
{
method: 'feed',
name: 'Facebook Dialogs',
link: 'https://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
caption: 'Reference Documentation',
description: 'Dialogs provide a simple, consistent interface for applications to interface with users.'
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
As you can see, the callback's argument (response
) includes an attribute called post_id
- this is the post_id of the story that was created when the user shared the content. As long as the user does not manually (or some other way) delete that story, you will be able to retrieve information about that post (comments,likes,etc..) based on that post_id at anytime.
Upvotes: 8
Reputation: 446
I ended up finding a simple solution, there's a link you can repurpose with an app ID and some URL params, one of the params happens to be a return url so I can process accordingly, with a little $_SESSION I can connect the share's success to the user.
https://developers.facebook.com/docs/reference/dialogs/feed/
Upvotes: 0
Reputation: 31870
You can use the Insights of your application to get statistical information on content shares. Please review: https://developers.facebook.com/docs/reference/fql/insights/
Upvotes: 1