I’ve been using Piwik to monitor and analyze web traffic for quite a while now. The Piwik app for Android is pretty good, but I was hoping to be able to see a quick overview without opening and drilling down into the Piwik app.
Luckily for me, my old friend Tasker was more than capable of helping me out here. Tasker was one of the first two apps I bought for my HTC Dream, and I’ve been relying on it ever since. I mostly use Tasker for things like turning my phone’s Wi-Fi on when I get home and automatically turning off Bluetooth when my headset is disconnected. One of my friends uses it to automatically open his OBDII logger when he plugs his phone into his car.
This time I am using Tasker to periodically download data from Piwik and create an Android notification out of the important bits. Most of this was pretty simple. Piwik will export data in a number of different formats. Tasker seemed to be best suited to parsing a CSV file but the way I ended up doing it would most definitely be considered cheating.
I’m all right with that, though, because it works!
You will want to edit these lines before you import this profile:
<Str sr="arg0" ve="3">YourHostName.com</Str> <Str sr="arg1" ve="3">/piwik/?module=API&idSite=2&date=today&period=day&method=VisitsSummary.get&format=csv&token_auth=YourAuthTokenGoesHere</Str>
You will want to supply the correct Piwik server name, site id (idSite=), and auth token (token_auth=…). These can be modified in Tasker after the profile has been imported, but it is probably less effort doing so with a real keyboard and text editor.