Twitter + Analytics = Love

2 minutes

Most of you are already accustomed with URL address shortening services. You know, those websites which make your URLs short and ugly so you can post them on Twitter, Facebook or just send them to a friend. The thing is you never know where these links end up and how much traffic they drive. For me, working in web analytics, not knowing something like this is itching like hell, so I have decided to find a solution to it.

Tackling the problem

What I did is create a special GreaseMonkey script for Firefox (you need to have GreaseMonkey installed), which offers the possibility of adding Google Analytics variables in order to easily track all the users clicking on the short URL you are just about to generate. Here is how the the new http://is.gd homepage will look like after you install the script.

is-gd-2

As you see, you have the possibility of adding 3 new fields: Campaign Source, Campaign Medium and Campaign Name. Filling in these fields will allow you to see all the visits generated by this link in Google Analytics. For example, I am going to tweet about this blog post on my twitter account and I will use the following data:

Campaign Source: Twitter
Campaign Medium: social-media
Campaign Name: Twitter-Analytics-Blogpost

If you want to know more about how to customize your links for analytics purposes, Roievolution.com has a great post on link tagging for Google Analytics.

Tomorrow, when I’ll get to office, I’ll login to my Google Analytics Account and will be able to see all the visits triggered by the Campaign Twitter-Analytics-Blogpost under Traffic Sources > Campaigns.

The beautiful part now is that in Google Analytics I will be able to segment all the traffic I have generated with this post and see  if  I did a good job in providing the content and experience in order to engage you.

The script works for any of the following shorten URLs websites:

I am just a ninja wannabe analyst, not a Javascript master. So, if you think you can improve my code, please do; if you manage to do something really cool about it, please let me know. I’d really feel proud about it. :)

Of course you already know about my love for Firefox and the great community that supports it. And then it’s Twitter, Facebook, WordPress and the list can go for miles. I am using all of these and they make my work easier and more pleasant, so today is my turn to give something back to the open web.

I’d like to thank Avinash Kaushik for the idea for this script. It was when reading one of his tweets that I got the idea of developing it.

If you would like me to add improvements to the script, make it available even for more ShortenURL services or if I can be of help in any way please tweet me (@cllaudiu) or just leave a comment to this post. Your feedback would really make me feel good about it :).

Last Update: Joost de Valk just posted on his blog a similar method (without GreaseMonkey) that uses the cli.gs service for tracking shorten URLs.

0.00 avg. rating (0% score) - 0 votes
Share
Simplify the eCommerce process. Try 2Checkout.
The most flexible digital commerce platform that can give your business a real boost.