Analysing click counts from bit.ly using Python and Tableau

I use bit.ly for link shortening. I also do monthly round ups of who’s been blogging about Tableau (for example here are February, March, April). I want to know how many clicks each link receives. Well – there’s an API for that. And with Tableau v8, there’s a way of going from API to TDE very easily, I wanted to learn how to use Python and the API code and this was the project for me! Here’s the results of the analysis; click the image for the interactive version.

 

Bitly links analysed

How did I do this, and how can you do this for yourself?

Learn python

Fortunately I’ve been writing code of some sort for years, but I did need to learn python kind-of-properly for this. I’ve uploaded the code to github – feel free to improve it or change it

Learn the data engine API

This was a breeze. I used two references. Ryan Robitaille’s early exploration blog was useful and then Michael Kovner’s how-to video gave me the rest of knowledge I needed.

Analyse in Tableau

The results are in the Tableau viz above.

Conclusions?

I’m grateful to Ryan, Michael and my friend Ben Foxall for help in this endeavour. It’s been really useful to learn the process of coding to get a TDE file.

2 Comments

Add Yours →

Andy, thaks for this. I tried executing your github code and I am receiving this error:

C:\>python c:\Bitly-to-TDE-master\Bitly2TDE.py
File “c:\Bitly-to-TDE-master\Bitly2TDE.py”, line 41
print ‘tde ok’
^
SyntaxError: invalid syntax

Thoughts?

Leave a Reply