Friday, November 11, 2011

Research: Twitter usage pattern in Egypt (Statistics, Peaktimes and Analyses)

The research below answer the following questions
  1. What is the usage pattern of Twitter by Egyptian users
  2. What is the peak/low usage times

The Research

I managed to conduct this research on a 2 weeks span using a script which does a Twitter search and calculates the average time between tweets (ATBT) every 10 minutes, these ATBT numbers and other information were saved and analyzed to deduce the conclusion below

Note: the same research has been made on Facebook, check the link below
http://karim-ouda.blogspot.com/2011/11/research-facebook-usage-in-egypt.html

Context:

Tweets gathered using #Egypt search string
Research duration: from 24/10/2011 - 06/11/2011


Conclusion

- Top peak time (all days) is 14:40 PM

Note: i don't know why exactly the peak is @ 14:40 PM, if anyone have justification  please let me know


- Peak hour (all days) is from 22:00-23:00PM

- Peak time spans are 14:00-16:00 PM and 20:00-23:00 PM

- Top day ( in terms of activity ) is Tuesday (Then Wednesday)

- The lowest (high ATBT) time span is from 1 AM and 10 AM

- The lowest (high ATBT) time is @ 5 AM


Charts

Overall Twitter usage by Egyptian users - Week #1 - ( 10 Min bases )






Overall Twitter usage by Egyptian users - Week #2 - ( 10 Min bases )










Overall Twitter usage by Egyptian users - Weekends




 Overall Twitter usage by Egyptian users - Hourly











Technical Stuff

I am posting the code i created to conduct this research in-case you need to do the same on a different sample/purpose ( also check the license below )

Prerequisites

1- Linux Os
2- Basic linux/shell scripting/programming knowledge
3- 24/7 internet connection

Steps

1- Add the following Linux shell commands to a script file (file.sh)

### Do twitter search for "#Egypt", extract the timestamp of each tweet and save it to a temp file
rm -rf twitterTemp.txt; GET http://search.twitter.com/search.json?q=%23Egypt | grep -o -P "(?<=\"created_at\"\:)\".*?\"" | sed -e 's/\(+0000\|"\)//g' > twitterTemp.txt



### Read tmp file (containing the timestamps), calculate the average of the time between consecutive tweets, append info to a csv file
prevTimestamp=0;count=0; timestampsCount=`cat twitterTemp.txt | wc -l `; while read dateline ;  do   timestamp=`date -d "$dateline" +'%s'`;   if [ $prevTimestamp -eq 0 ];    then  prevTimestamp=$timestamp;  fi ;  count=$[$count+$[$prevTimestamp-$timestamp]];  prevTimestamp=$timestamp; done < twitterTemp.txt; avgTweetInterval=` echo "scale=1; $count/$timestampsCount" | bc ` ;  echo  `date "+%Y-%m-%d, %a, %H, %M"`, $avgTweetInterval >> twitter-statistics.csv ;


2- create a cron job to run this file every 10 min

crontab -e
0,10 * * * * /home/user/file.sh
CTRL-O
CTRL-X


FAQ

1- How do you track twitter usage pattern

Answer: through calculating the average of all time intervals between consecutive tweets

2- How do you know that the tweets were entered by Egyptian users

Answer: by searching the "#Egypt" hash tag, which is mostly used by Egyptian users

3- How do you calculate the average time between tweets (ATBT)

Answer: check the diagram below



Copyright/License


Creative Commons License
Twitter usage pattern in Egypt statistics, research and code by Karim Ouda is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

Relevant Research


http://mashable.com/2012/05/09/best-time-to-post-on-facebook







4 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. Thank you so much this information has been very useful! I've included this link in the reference section of my research :)

    ReplyDelete
    Replies
    1. Good to hear that, just take care that the pattern probably changed by time

      Good luck Sara

      Delete