Using the Twitter API for Analytics

Twitter is probably the most popular social media channel among businesses that are trying to harness the power of social media. It is therefore of paramount importance to the business community that there be an efficient way of retrieving metrics out of Twitter. The Twitter API serves this need just right. It is one of the most advanced and powerful APIs that are there in the social media space.

My focus in this post would be to introduce the capabilities of the Twitter API from a social media reporting and analytics point of view. I would also touch upon the restrictions that the API imposes on users.

Twitter has a REST based API which can be used by developers to access almost all the static data points and dynamic metrics that the channel offers. These data points and metrics are mapped to specific access ports in the API which are called API endpoints/resources. The developers need to direct their queries to these endpoints in order to access the datapoints/metrics. A complete list of the API endpoints that can be accessed is available here.

One can easily get overwhelmed with the variety and amount of metrics that can be retrieved using the Twitter API. It is therefore advisable that you identify and freeze on the Key Performance Indicators (KPIs) that you want to track before you start with the actual development process. This will give you better clarity on what is required and what can be ignored in your case. Below is a list of the most useful data points/metrics that can be retrieved for each Twitter handle/username. This list might vary based on the business requirement that one is trying to cater to.

  • Number of Followers
  • Number of Following
  • Number of Tweets
  • Number of Favorites
  • Number of Listed
  • Profile IDs of the followers
  • Profile IDs of the people the user is following

The API returns the above metrics/data points on a cumulative basis (till date basis) and not for a specified time frame. This might seem to be a problem for people who want to extract these metrics on a periodic basis. One way of getting around this restriction is by retrieving the metrics twice – once at the beginning of the time period and once at the end of the time period and then subtracting the values. For example – Let’s say that I want the above metrics for the month of July 2011. I would need to extract data once on July 1st and then once on July 31st. To arrive at the numbers for July, I simply subtract the July 1st values from the July 31st values.

The Twitter API imposes certain limits on applications that access it. The limits are primarily in terms of the number of requests that an application can make to the API. The limits vary depending on the authorization type being used by the application.

  • For unauthenticated calls, the rate limit is 150 calls per hour. These calls are measured by keeping a track of the public facing IP making the calls.
  • For authenticated calls, the rate limit stands at 350 calls per hour. The OAuth token is used to keep a track of the number of requests.

Each data point queried by the application comprises one API call.

Advertisements
This entry was posted in Tools and Technologies and tagged , , , , , , , , . Bookmark the permalink.

3 Responses to Using the Twitter API for Analytics

  1. Eddie Gear says:

    Interesting if you are looking for a custom solution. Else I would rather go for pre made web based solutions that offer quite a bit of the information you are gathering. This provides more time to focus on the marketing aspects.

    • Bibhash Chakrabarty says:

      @Eddie – I agree that developing API applications takes a little time. However, I feel its worthwhile if you have a repetitive use-case considering that its a one-time investment. Once you have the application up and running, subsequent data pulls hardly take any time. The breadth of the data and the accuracy are also very high. Besides, you don’t need to depend on a third part application which can shut its service at any point.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s