Setting Up a Piwik Notification on Android with Tasker

| Comments

Update: You might want to skip all of this. My friend Brian took what I had here quite a bit further, and he has made a much more comprehensive Piwik notification for Tasker. You should definitely check it out!

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!

On the tablet On the phone

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&amp;idSite=2&amp;date=today&amp;period=day&amp;method=VisitsSummary.get&amp;format=csv&amp;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.

The Tasker site very briefly explains how to import a profile. You can download my Tasker Piwik profile here:

Piwik.prf.xml

Comments