Is there an event that fires when a user shares something on their wall?
I'm successfully capturing the subscribe event when they click "Like", but I want one when they share it in the drop down box that shows up when you click the Like button.
I can't find any documentation on this, so I'm wondering if this exists or not.
it looks like you need to listen for the comment.create (instead of the edge.create) event in the FB callback...
http://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/
I haven't tried it, but I suspect it works.
Related
I have a problem while detaching a listener to a node in firebase. I am currently building the chat interface of the app, so you can imagine what I am talking about here.
So to listen to the chat and actually display all the messages I use:
firebase.database().ref('/path/to/relevant/chatNode').on('value')
I also have another view in the app that lists all current active chats and it displays the name of the person you are chatting with and underneath you see the last message that is available in the chat.
To keep that last part in sync with the DB I use:
firebase.database().ref('/path/to/relevant/chatNode').limitToLast(1).on('child_added')
Now the issue is that I want to stop listening to changes once the users exits from the view that displays all the messages. Basically I want to call .off() on listener number 1, but NOT on number 2.
However, I just realized that .off() stops both listeners. Is there a way to specify which type of listener I want to stop syncing or do I need to recall listener number 2 once the user navigates away from the actual chat?
In the firebase docs you can find this line:
You can remove a single listener by passing it as a parameter to off().
How do you pass a single listener as a parameter?
When you register a listener with on() it will return the function. You can pass that into off to stop only that listener.
So:
var listener = firebase.database().ref('/path/to/relevant/chatNode').on('value')
And then:
firebase.database().ref('/path/to/relevant/chatNode').off('value', listener)
I would like to handle click events on the notification box by notifyjs, to link user to another page.
I understand that I could use jquery selector to select notifyjs class but that would break other notifications that are not meant to do the redirect.
I've look through notifyjs webpage and there's no click event documented.
How can I do so?
Thanks.
I'm using the AddThis widget to enable the sharing of site content towards Twitter, Facebook and Google+. I have signed in users on my website and am looking into making an association between the signed user and his sharing behavior.
For this I need to listen to the callback of the Addthis widget, here's the direct example from their website:
function shareEventHandler(evt) {
if (evt.type == 'addthis.menu.share') {
alert(typeof(evt.data)); // evt.data is an object hash containing all event data
alert(evt.data.service); // evt.data.service is specific to the "addthis.menu.share" event
}
}
// Listen for the share event
addthis.addEventListener('addthis.menu.share', shareEventHandler);
The problem with this event is that it is triggered before actually sharing something. For example, a user clicks the "Tweet" buttton, this script is triggered, the Tweet dialog is launched, and the user either moves forward or cancels the sharing in that dialog.
Ideally, the event handler is triggered once the actual sharing was done successfully, and not when the user cancels it. It doesn't seem possible from the official documentation, but I wanted to try nevertheless if anyone has a creative workaround?
possible workaround:
i'm assuming that post sharing the addthis content box is altered...do a check for this element (probably a class(es)) to ensure sharing success
I'm integrating the Facebook Send button to our site and I'm trying to run some javascript as soon as the user sends the page to someone. With the Facebook Like button you can subscribe via javascript to the edge.create event which fires when the user Likes the page. Is there an equivalent for the Facebook Send button? I tested it and the edge.create doesn't catch the Send button.
So basically, is there any javascript event handler for the Facebook Send button?
The event you're looking for is "message.send" according to https://developers.facebook.com/docs/reference/plugins/send/
You should be able to add your own listeners by directly subscribing them to the classes prototype.
For example, we use this to reposition the Like/Send menus accordingly once rendered:
var Like = FB.CLASSES['XFBML.Like'];
Like.prototype.subscribe('xd.presentEdgeCommentDialog', function(a){
setTimeout(function(){
var el = $('#like-btn > span.fb_edge_comment_widget');
// console.log(a);
// console.log(el);
el.css('left', '-200px');
el.css('top', '20px');
}, 500);
})
The exact events you can subscribe depend on the class. You'll need to research this by looking to the JS SDK and then backtracking which events are being fired.
Good luck.
Hmm, have you tried to add a function that looks for the send button and adds your own click listener to it when it gets added?
You won't be able to get any information like response.session, but you can tally how many people click the button.
I can see why they didn't include anything to subscribe to with FB.event.subscribe. When they like your page, connect elements on your page are populated with their information when the page reloads (you may reload the page in your method that gets fired). They can send your page to someone without liking you.
I am trying to alert the user when they leave the shopping page with cart filled up. And also get feedback or the reason for their exit.
I need to get event source id because to know whether they exit my site or navigate by clicking a link in my page.
Any one help me on this...
It's not possible. You should be able to catch if the user clicked a link to leave the page by manually setting up a listener event on each of them, but the browser does not give you any information about what led to the unload event. If it was an event ouside the document ("Back" button etc.), you're out of luck.