Last active
December 20, 2015 19:49
-
-
Save niraj-shah/6185935 to your computer and use it in GitHub Desktop.
Tracking tweets using Web Intents and the Twitter API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Include the twitter JS library --> | |
<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script> | |
<!-- Tweet button with just text --> | |
<p><a href="https://twitter.com/intent/tweet?text=My first tweet using Web Intents">Tweet</a></p> | |
<!-- Tweet button with link and text --> | |
<p><a href="https://twitter.com/intent/tweet?url=http://www.webniraj.com/2013/08/08/twitter-api-tracking-tweets-using-web-intents/&text=Tracking tweets using Web Intents:"><img src="https://dev.twitter.com/sites/default/files/images_documentation/bird_blue_48.png" /></a></p> | |
<script type="text/javascript"> | |
twttr.ready(function (twttr) { | |
// bind to the tweet event | |
twttr.events.bind('tweet', function( event ) { | |
// add ajax call here to store the tweet details | |
// i.e. increment a counter in your database | |
console.log( event ); | |
} ); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment