How can we log the follower statistics for a Twitter account?
In order to store these stats, I’d like to use IFTTT’s new Maker channel that was introduced last month. I have created a simple Bash script (tstats.sh) to log this data to a spreadsheet in my Google Drive. I run this as a cron job every 24 hours.
Prerequisites
Ruby:
sudo apt-get install ruby-dev
gem install t
Authorize your Twitter account:
t authorize
A Google account, as the log is saved to a spreadsheet in your Google Drive.
An IFTTT account.
Connect the Maker and Google Drive channels to your IFTTT account.
Usage
cd into the tstats directory and edit the script with your IFTTT secret key, your IFTTT trigger event name and your Twitter screen name. Make the script executable with:
chmod +x tstats.sh
Then simply run it with:
./tstats.sh
If you receive a „Congratulations“ message and an entry is added to your spread sheet, you can go ahead and add it to your cron to run at a predetermined time.
To have this script run every 24 hours, add this to your crontab (you may need to change the path):
42,09 * * * * /home/user/tstats/tstats.sh >/dev/null 2>&1
[Update 26 Jul 2018] Now on GitHub: Yes, three years later this script is still hot! However, WordPress is not the perfect place to host code. As part of my preparation for my TC18 session on Social Media in New Orleans, I moved the code to a GitHub repositroy: https://github.com/aloth/tstats
Are you attending my #TC18 session on Social Media Analytics with @Tableau? Get prepared by logging your Twitter stats from today with #tstats! #github #tbt https://t.co/1lJBj55rdP pic.twitter.com/ohGOVRX5OM
— Alexander Loth (@xlth) July 26, 2018