Just a short tip this week (1 day late mind you):twitter_developers

I've been trying to make a function call when a user is Tweeting using my "Tweet" button:

tweet_button

Twitter has a nice function set to make sure you can react to different events happening, like:
tweet, follow, retweet, favorite, click.

It's pretty easy to understand what all of those do, in my case ("tweet") only when the user clicks the Tweet button on the following popup:tweet_popup

the function is called.
This is an example script to make this happen:

1
2
3
4
</p>
<p>twttr.events.bind('tweet', function(event) {
     alert(&quot;Post successful&quot;);
 });</p>

My mistake was that I forgot making sure Twitter was ready (very much like document.ready), like this:

1
2
3
4
5
6
</p>
<p>twttr.ready(function (twttr) {
     twttr.events.bind('tweet', function(event) {
         alert(&quot;Post successful&quot;);
     });
});</p>

Here's a comprehensive list of the events & what they do from Twitter's website.
I've also added a working example of the script.