How can I fire an event when someone presses the NEW Facebook Subscribe button? I can do that with the "Like" button, using the code above, so I thought that it will be similar with the Subscribe button.
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({appId: 'App_ID', status: true, cookie: true, xfbml: true});
FB.Event.subscribe('edge.create', function(href, widget) {
alert('You just clicked the like button');
});
};
(function() {
var e = document.createElement('script');
e.type = 'text/javascript';
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
The 'edge.create' fires an event when the user likes a page, so I can get the response, and show the alert to the user. I've searched for a while, and couldn't find a way to a similar thing with the "Subscribe" button.
Has anyone done that?
Unfortunately, Niraj's answer is incorrect. There are functions in the FB API that handle detecting events like you describe, but there is nothing that can detect if a user is subscribed as of now. You can detect if a user like, unlikes, comments, etc. but not if a user subscribes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With