Twitter Stats
Final Update to This Post For those not following along at home, I finally took Twitter Stats to the next level and released a webified version over at TweetStats.com. I, somewhat unfortunately, had to go with TweetStats as twitterstats.com was already taken.
I made a post about it here and you can see an example of my stats on the site on the graphs page.
So I’ve been a user on Twitter for a little over a year, but it wasn’t until recently when I hit 2000 tweets that I wanted to see what my Twitter history looked like over that period. Ever being the statistics nerd, I pulled down all of my tweets and using a combination of curl, sed, grep, Excel, and Numbers, managed to generate some nice graphs.
Being the automation weenie that I am, I eventually hacked together a perl script that did everything except paste the data into Numbers.Although I won’t post it here (because I think the Twitterocracy would have a cow with how it’s implemented), you can DM me your email and I’ll send you the code and instructions. See below – bugs be damned, I’ve made it publicly available.
Basically, the script pulls down all your tweets and stores them in an csv file. It then runs some statistics on the csv file and then copies the resulting stats to the OS X clipboard to paste into each table within Numbers. If run with a pre-existing tweets csv file, the script will calculate the different between your current status count and only download the pages necessary, thus saving the Twitter servers from some bandwidth.
For the record, here are mine. ![]()
Update Thanks to kosmar for pointing out that I can actually do this entire thing without your password. Head => Wall. I’ll be updating it accordingly and hopefully even making a webservice out of it soon.
In addition to not needing your password, the script should also adjust the times for your tweets to whatever the system time is where you run the script.
Another update: I’ve also posted the script on my site and you can download it here: twitter_stats.zip. Feel free to contact me with any questions via twitter or web.dpc at dcortesi . com.
Many people have noticed a large after-lunch spike around 2pm. At least for me, this was due to Twitter being down most of the morning one day and then tweeting like crazy when it came back online.
BUG FOUND AND SQUASHED
There was a small bug that cropped up after I switched the script to not require your password. It accounts for the odd “[Tuesday|January|2pm] Peak” that people were seeing. This bug has now been fixed and an updated script is available. My apologies.
Unfortunately, if want the most accurate tweets, you will have to rm your csv file and run the script again.
Date::Calc aka failure on line 13
Some of you (on Tiger?) may be missing the Date::Calc module that I use to figure out weekdays. Although I tried to use as few perl modules as possible, this one was essential. Use the following command (thanks to a couple twitter peeps for the reference) to install:
sudo perl -MCPAN -e 'install Date::Calc' and keep hitting ‘y’.
Final (hopefully) Update on this page as it’s getting messy.
For those of you not on OS X with Numbers, there are a few options:
@bck webified my code (w00t): Twitter Stats
@mmc decided to use gnuplot: Twitter Stats in SVG Using GNUPlot
@cbarrett modified it to utilize the Google Chart API: Twitter Stats with GChart
@kejadlen reverse engineered my original script to Ruby: Twitter Stats in Ruby
I still want to write my own webified version (Google Chart aesthetics leave a little bit to be desired…), but I have yet to settle on an option that I like.


That is just too awesome.
December 27th, 2007 at 10:08 pmHi Damon,
That’s just awesome! Since I just reached the 7,000 updates score today, I’m eager to have a look at my own stats. Would you be so kind to share your scripts with me?
TIA,
Christophe LaueR
–
December 28th, 2007 at 8:42 amhttp://twitter.com/clauer/
O_o i’d love to see this. you got my mail …
December 28th, 2007 at 8:43 amcongrat for this…can i have mine?…txs
December 29th, 2007 at 7:25 amTwitter statistics…
After I learned via @twtooltrack that Damon Cortesi had hacked a perl script to find out some basic stats of your own twitter behaviour, I just asked him for the file and ran it on my account. Here is what came out:
One more click for the large vie…
December 29th, 2007 at 7:37 amThis is going to be awesome. Can I have the instructions? I am super excited to see some stats on my tweets
Thanks.
January 1st, 2008 at 7:01 pm[...] day to post some graphs of my Twitter usage. A huge amount of thanks goes to Damon Cortesi for his work on the Perl script that creates these stats and the Numbers template for creating the pretty [...]
January 1st, 2008 at 7:53 pmSlick. Thanks for sharing.
January 1st, 2008 at 8:00 pmToo bad-ass! Can’t wait to unzip it! :^)
January 1st, 2008 at 8:31 pmI really like using it, fun to see all the results and such. I’ll write an entry about it soon. I’ll help to promote it.
January 1st, 2008 at 8:32 pmVery cool and easy to use. Thanks.
January 1st, 2008 at 8:54 pm[...] stats! Thanks to Damon Cortesi (https://twitter.com/dacort) for his awesome Twitter Stats script (http://dcortesi.com/2007/12/27/twitter-stats/). And to think. I said I wouldn’t use Twitter. I said I wouldn’t become addicted. I [...]
January 1st, 2008 at 9:05 pm[...] was kind enough to gather my Twitter stats for me. Check out his blog for the script he created to do [...]
January 1st, 2008 at 9:12 pmSo, I noticed you wrote that you no longer have to use your password for this script. Convenient, yes, although I just wanted to mention that for those with protected tweets it doesn’t work. Easy for me to solve. I just unprotected mine as it downloaded them, then protected again. But I think it would be handy to keep a version of this that asks for a password to get around that.
January 1st, 2008 at 9:13 pmAwesome work!
Rob – good catch, I hadn’t considered that.
I’ll make one available at some point that can use your password.
January 1st, 2008 at 9:21 pm[...] djmartian wrote an interesting post today onHere’s a quick excerpt [...]
January 1st, 2008 at 9:35 pm[...] stats Use this cute perl script + Numbers template to take a slightly different look at twitter activity. Here’s mine; I am @bkerr on [...]
January 1st, 2008 at 9:49 pmDoes the bug you just fixed explain why DaringFireball.net and RandsInRepose.com both report post-lunch spikes?
January 1st, 2008 at 10:44 pm[...] Damon Cortesi has published a nifty Perl script that generates stats based on your Twitter usage. [...]
January 1st, 2008 at 11:33 pm@nickon It would appear that way, unfortunately. :-\
I’m also aware some ppl don’t have Date::Calc installed and am looking for specific steps to get that installed. (Somebody else mentioned there were several steps, but I already have it installed as well as several different versions of perl :-\)
January 1st, 2008 at 11:34 pmThis is great! Found a typo:
“Press enter to download remaining tweets and calcuate stats!”
“calcuate” should be “calculate”
Also, for protected tweets, this would be a great use of OAuth!
http://twitter.com/oauth
January 1st, 2008 at 11:44 pmhttp://oauth.googlecode.com/svn/code/perl/
Dude! THis is a damn sweet little perl script. We should tie it into a graphic lib so that you can have this automatically appear on your website
January 2nd, 2008 at 12:07 am@whurley That’s the plan.
Somebody already suggested Flot and Google Chart API (of course). It’s just a matter of sitting down and whipping up that code.
January 2nd, 2008 at 12:12 amVery cool, I’m building the new http://whurley.com in perl so this will fit right in
January 2nd, 2008 at 12:22 am[...] DCortesi . blog ? Twitter Stats A perl script for OS X that pulls down your public tweets and allows you to graph them using Numbers… [...]
January 2nd, 2008 at 12:30 amRegarding implementation with Google Chart API: I’ve done it for you, for reasons I can’t entirely explain. (I was going to use tonight to start blogging again. So much for that idea.)
Right now it only emits the GCAPI URLs to STDOUT rather than actually doing anything useful like creating a web page with them. I’m going to fix that, but I’m posting this now as it’s already well past midnight. There are also a few bugfixes in there – it may be worth diffing to find them.
January 2nd, 2008 at 12:44 amAhem, not that URL. This one.
(This is why I should just go to bed now instead of continuing to hack on this.)
January 2nd, 2008 at 12:45 am@Yoz Sweet, nice job! I’ll have to try it once I’ve had a little sleep too. ;o)
January 2nd, 2008 at 1:09 am[...] year of Twitter. Late last night I saw a tweet from Tim Lauer referring me to a Perl script from Damon Cortesi “that pulls down your public tweets and allows you to graph them using Numbers.” Pretty [...]
January 2nd, 2008 at 1:34 am[...] on the lookout for analytics to describe behavior, I ran across a perl script by Damon Cortesi tonight that pulled in my Twitter feed and generated some pretty graphs. The results – my Twitter [...]
January 2nd, 2008 at 1:40 amYou can get that CPAN install with even fewer keystrokes:
$ sudo cpan Date::Calc
January 2nd, 2008 at 2:20 am[...] So here are my Twitter stats. Generated and made pretty by the awesome script created by Damon Cortesi. [...]
January 2nd, 2008 at 2:26 amDamon, just a few questions. I assume most of this info is global according to your list of tweeps? Because according to the stats, I’m tweeting while I sleep, and I can’t recall 300+ tweets I made on Monday. This could also be indicative of a serious addiction on my end.
Is there a way to just find out my personal stats?
Could you provide a summary for each table to help us understand what each represents? For instance, I’m not clear on the difference between top conversational @’s and top @replies.
Thanks for this script, BTW. It’s very cool to see Twitter, Numbers, and Terminal merge usefully.
January 2nd, 2008 at 3:34 amI tried it few weeks ago too, to determine the time of the day my friends were twitting, here is the result:
http://blog.alexgirard.com/2007/11/12/ruby-twittline/
January 2nd, 2008 at 3:39 am[...] Twitter lovers out there, like me, I’ve put together a little script based on the work found here to calculate some statistics from your Twitter timeline and present them using the Google Charts [...]
January 2nd, 2008 at 4:37 amHi Damon, for some reason the script hangs forever on my tweets, and there are only 32. Same with http://bradkellett.com/twitter_stats.html which is based on it. Try to crunch my Twitter at http://twitter.com/pdwn
Bonne ann?e, best wishes for 2008.
January 2nd, 2008 at 6:14 am[...] ajutorul motorului de la Google Charts. Codul a fost adaptat de autorul Brad Kallet dupa cel de la DCortesi. Dupa ce desenele sunt generate, datele personale ale utilizatorului de la Twitter sunt [...]
January 2nd, 2008 at 6:54 am[...] El servicio, simple como hay pocos, solo requiere que introduzcas el nombre de usuario de Twitter, tipo @tunick y te muestra gr?ficos. El sistema est? elaborado a ra?z del script para Mac de DCortesi. [...]
January 2nd, 2008 at 8:40 amon the Date::Calc install i am getting an error in Terminal:
Recursive dependency detected:
Date::Calc
=> S/ST/STBEY/Date-Calc-5.4.tar.gz
=> Bit::Vector
=> S/ST/STBEY/Bit-Vector-6.4.tar.gz
=> Carp::Clan
=> J/JJ/JJORE/Carp-Clan-5.9.tar.gz
=> Object::Deadly
=> J/JJ/JJORE/Object-Deadly-0.09.tar.gz
=> Carp::Clan.
Cannot continue.
anyone else getting this?
January 2nd, 2008 at 8:56 am[...] a bit like navel gazing to me. So by that logic Twitter would be Micro Navel Gazing (TM). Enter Twitter Stats, The Atomic Navel [...]
January 2nd, 2008 at 9:27 am[...] todo gracias a Brad Kallet, quien adapt? el script que Damon Cortesi realiz? para la plataforma Mac OS X, de manera que a trav?s de su web podemos recibir una serie [...]
January 2nd, 2008 at 9:48 amI thought I was never gonna be able to do this, not knowing any Perl and being a terminal newbie, but it was easy enough.
I wrote a quick guide how to it: http://www.wolfslittlestore.be/twitter/how-to-get-your-twitter-stats-for-2007
January 2nd, 2008 at 9:50 amKyleon: Yes, I got that. I solved it by updating Bundle::CPAN first. The command would be as follows:
sudo perl -MCPAN -e ‘install Bundle::CPAN’
As usual, keep hitting y to install all the dependencies. Then go back and re-install Date::Calc.
January 2nd, 2008 at 9:55 amTwitter stats using Ruby…
I saw Damon Cortesi?s Twitter Stats script last night, and decided to make a Ruby version….
January 2nd, 2008 at 10:19 am[...] My Twitter Stats of 2007 thanks to Damon Cortesi. [...]
January 2nd, 2008 at 11:09 amOoh, that looks so cool! If only I could run it, though; I have neither Perl nor OS X.
January 2nd, 2008 at 12:15 pm[...] Cortesi has written a great little perl script that will generate your Twitter Stats which are then turned into some cool graphs of using the Numbers [...]
January 2nd, 2008 at 12:31 pm[...] a Numbers template to paste them into. Since I don’t have Numbers, I’ve modified his script to write a file that can be read by gnuplot, and wrote a basic gnuplot script to output an SVG file [...]
January 2nd, 2008 at 1:05 pm[...] es posible gracias a Brad Kallet, quien adapt? el script que Damon Cortesi realiz? para la plataforma Mac OS X, y que a trav?s de su web se puede generar una serie de [...]
January 2nd, 2008 at 2:25 pm[...] so pretty Twitter Stats With the recent surfacing of Damon Cortesi’s Twitter Stats I experienced my first real case of Mac envy. I tried running the Perl script on my Debian box, but [...]
January 2nd, 2008 at 2:54 pm[...] Download the Twitter stats zip at http://dcortesi.com/2007/12/27/twitter-stats/ . [...]
January 2nd, 2008 at 3:13 pmHi Man.
January 2nd, 2008 at 3:34 pmJust a question. Why did you decide distribute your software for local running instead of hosting it in anyserver?
Is it due to the Twitter’s API usage restrictions?
Thanks in advance.
Hey Xurde – Perl was the easiest thing for me to hack the script up in and I really liked the way that the graphs generated by Numbers looked, so that’s the main reason I didn’t webify it. I didn’t initially expect to distribute it either, but I really enjoyed hacking away at it.
I’ve found a couple graphing packages that I like, but just have to sit down and pound the code out to support one of them.
Local development was a much quicker way for me to utilize currently existing tools to achieve a more pleasing result.
January 2nd, 2008 at 3:51 pm[...] care to know your Twitter Stats? Posted in twitter, stats | Trackback | del.icio.us | Top Of [...]
January 2nd, 2008 at 9:24 pm[...] Get stats on your Twitter usage (tags: analytics twitter) [...]
January 2nd, 2008 at 9:28 pm[...] DCortesi . blog ? Twitter Stats A Perl script that pulls data from your public Twitter stats and produces data to be pasted into a Numbers spreadsheet for data visualization… (tags: twitter visualization osx perl) [...]
January 3rd, 2008 at 12:24 am[...] DCortesi . blog ? Twitter Stats (tags: twitter statistics script osx) [...]
January 3rd, 2008 at 1:25 amDoesn’t work with foreign charaters like the german umlauts (?, ?, ?) if you wanna test it, run the script against my username: ?daskaja?. Seems like sed is the problem.
January 3rd, 2008 at 7:30 am[...] to Damon for the hard [...]
January 3rd, 2008 at 8:33 am[...] habla hoy sobre Twitter Stats1, un programa escrito en Perl que los usuarios de Mac OS X que tengan Numbers instalado pueden [...]
January 3rd, 2008 at 10:34 am[...] Twitter Stats. Basically, the script pulls down all your tweets and stores them in an csv file. It then runs some statistics on the csv file and then copies the resulting stats to the OS X clipboard to paste into each table within Numbers. © 1999-2008 Justin Blanton (e-mail) e v e r y t h i n g i s r e l a t i v e In partnership with [...]
January 3rd, 2008 at 5:54 pmAmazing script, thank you
January 3rd, 2008 at 8:28 pm[...] Jens Meiert via Twitter bin ich heute mal auf Twitter Stats gestoßen, einem Skript von Damon [...]
January 4th, 2008 at 5:37 am[...] TwitterStats [...]
January 4th, 2008 at 9:09 am[...] You can get the script over at http://dcortesi.com/2007/12/27/twitter-stats/ [...]
January 4th, 2008 at 2:51 pm[...] fem m?neder siden jeg skrev min f?rste Twitter-status, og for noen dager siden kom jeg over Twitter Stats av Damon Cortesi som kartlegger Twitter-bruken [...]
January 4th, 2008 at 4:27 pm[...] thing I’m lazy… wait a day or two after seeing the original code and someone makes a nice little Twitter stats web service out of it (found via a CogDog [...]
January 4th, 2008 at 11:05 pm[...] when I saw this Twitter stats script, I was intrigued to see what my numbers looked like. Call it internet naval-gazing, but I find it [...]
January 6th, 2008 at 12:03 pm[...] Cortesi wrote a cool perl script that sucks down a user’s tweets from 2007 and creates pretty charts via a Numbers.app [...]
January 6th, 2008 at 6:10 pm我的twitter??…
下面是来自?里的我的twitter使用情况的???表: Current statuses count: 4124 —- Tweets per Hour ——– Tweets per Day ——– Tweets per Month ——– Top @replies ——– Top overall @’s —- ?里有相?的介…
January 7th, 2008 at 4:44 am[...] January 7, 2008 · No Comments Thanks to a random discovery on Tara Hunt’s Flickr stream, I found out about Damon Cortesi’s script for generating charts out of Twitter. [...]
January 7th, 2008 at 4:57 am[...] up in the middle of the year thanks to programs like Twitterrific and Twitterberry. Now thanks to Damon Cortesi, who hacked up a quick and dirt script, you can see a visualization of my Twitter activity for 2007 [...]
January 7th, 2008 at 12:33 pm[...] cool. He also mentions he’s wanting to get his up on the web too. Quick reference to his original perl script. Tags: Twitter, Twitter Hacks, Twitter Stats, Perl, Ruby SHARETHIS.addEntry({ title: “Twitter [...]
January 7th, 2008 at 5:51 pm[...] not jealous, but insane? Totally. No really, I thought “hey, that’s cool.” The script he linked to was for OS X, which I don’t use so I waited. Today I found a site that did it online. The [...]
January 7th, 2008 at 8:23 pm[...] DCortesi . blog ? Twitter Stats graph your twitter stats (tags: twitter statistics stats visualization script analytics web2.0 chart graph) [...]
January 9th, 2008 at 2:19 pm[...] week ago, Damon Cortesi (who happens to be one rockin’ guy) wrote a little Perl script to help Twitter users create some really pretty graphs that chart their Twitter usage over the past year. In the week or so that has followed, everyone [...]
January 10th, 2008 at 3:10 am[...] Cortesi over at DCortesi Blog recently commented about tracking his Twitter Stats.? With over 2,000 Tweets (sum of Twitters), he wanted to understand what his history looked like [...]
January 16th, 2008 at 5:26 amI am new to twitter (18 posts), but when I tested the script it either took over 10 minutes and revved up my macbook fan because it was working like crazy… or it just hung. I have the newest version of leopard, can that be the culprit?
January 20th, 2008 at 2:56 pm[...] they should come out with social stats, like the ones Damon Cortesi and a few others made. But of course with stats being a native part of the platform it would be [...]
January 29th, 2008 at 9:21 am[...] Stats01.30.08 | Comment? Last month a twitter stats script was released by Damon Cortesi. The small script connects to twitter and downloads all of your tweets for statistical analysis. [...]
January 30th, 2008 at 9:03 amThanks for the great script! I just posted stats to my blog. I’m running Leopard and was not only missing the Date::Calc module. I also was missing LWP which posed difficulty in downloading bundles. Luckily, I am a user of MacPorts and after installing lynx and wget (also surprisingly missing) I was able to reset the CPAN setup and proceed. Hopefully my experience will help someone else.
January 30th, 2008 at 9:08 am[...] in the month, we told you about TwitterStats, a downloadable script that would graph your Twitter statistics. The author of TwitterStats, Damon [...]
January 30th, 2008 at 3:36 pm[...] in the month, we told you about TwitterStats, a downloadable script that would graph your Twitter statistics. The author of TwitterStats, Damon [...]
January 30th, 2008 at 5:20 pm[...] que utiliza esta medio. Ya existen APIs para jugar con nuestras estad?sticas de microbloggeo como TwitterStats, sitios que pretenden acercarnos a otros usuarios que comparten intereses m?s o menos parecidos, [...]
January 31st, 2008 at 10:56 pm[...] TweetStat [...]
March 13th, 2008 at 1:11 pm[...] fem m?neder siden jeg skrev min f?rste Twitter-status, og for noen dager siden kom jeg over Twitter Stats av Damon Cortesi som kartlegger Twitter-bruken [...]
March 15th, 2008 at 1:13 pm[...] TwitterStat Twitter??数据 [...]
March 21st, 2008 at 5:10 pm[...] some ways to get this information and stumbled across http://tweetstats.com, which is based on a perl script to generate some cool information but it takes too long and is not exactly what I wanted.? At [...]
March 25th, 2008 at 9:14 pm[...] Cortesi wrote a pretty nifty script to grab some Twitter statistics. A bunch of people modified his script in order to webify it, plot the results using gnuplot, and [...]
March 29th, 2008 at 9:12 pm[...] ?里有相?的介?。?里有更多的twitter??工具。 [...]
December 27th, 2008 at 9:57 am[...] week ago, Damon Cortesi (who happens to be one rockin’ guy) wrote a little Perl script to help Twitter users create some really pretty graphs that chart their Twitter usage over the past year. In the week or so that has followed, everyone [...]
January 17th, 2009 at 11:12 pm[...] is another interesting point of study pertaining to what data conveys about an individual. Enter Twitter Stats: a Perl script that chews on some data from Twitter’s API and spits back some slick graphs [...]
February 8th, 2009 at 5:46 pm[...] Cortesi wrote a pretty nifty script to grab some Twitter statistics. A bunch of people modified his script in order to webify it, plot the results using gnuplot, and [...]
March 1st, 2009 at 2:46 pm[...] Twitter Stats: Another mashup alternative to visualize your Twitter stats [...]
April 24th, 2009 at 11:24 pmJust for the record, I absolutely hate bar graphs when trying to graph something, especially my tweets. :/ The service is pretty useful but doesn’t use line graphs..
June 5th, 2009 at 11:36 amHas Twitter changed the source since this script was written? The reason I ask is because I tried using it but it doesn’t find any of the regex stuff on the page. I tried it with and wihtout logging in. Any thoughts?
-Paul
September 19th, 2009 at 10:50 amHi Paul,
As noted at the top of the post, I wrote TweetStats to replace this script and no longer maintain it. Twitter’s web site has changed significantly since I first wrote this and the API is now the preferred means of accessing data such as this. Feel free to head on over there and graph your stats.
Damon
September 20th, 2009 at 3:42 pm