If someone using a desktop Twitter client (such as TweetDeck or Twirl) clicks on a link I've posted to my blog, the Google Analytics referer information will be blank. It registers as direct traffic to the website.

This is fine when linking to other people's websites — I'm not worried about them — but I'd like to know where that traffic to my websites comes from.

I generally shorten URLs with a service like bit.ly (which does provide basic statistics on click throughs). The trouble here is that you still miss the referrer information on your Google Analytics account.

How can we capture that the source of the link was a Twitter post?

The Analytics Talk blog post — Twitter and Google Analytics: What to Track — gives a good solution to this problem.

Put simply, before you shorten the URL, add the following GA campaign request parameters to the end:


Now you can track referrers from Twitter clients within Google Analytics using
Traffic Sources | Campaigns. Nice.

Check out Twitter and Google Analytics: What to Track by Justin Cutroni for the details.

Aside: Justin's Google Analytics Short Cut PDF book ($10 from O'Reilly) is a great read, but it was written in 2007 before the last GA update. I hope Justin gets the time to release an updated version soon.