The Tweet Button is usually:

<a href="https://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="someone">Tweet</a>
<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>

and here I can get a callback when the user tweets:

<script>
  twttr.events.bind('tweet', function(event) {
    console.log(event);
  });
</script>

What I don't understand: how does twitter give me this callback? The tweet is done in another window and from another domain. How is this possible?

Edit
Report