Reporting on a custom column/dimension?


#1

Howdy. I’ve been tasked with tracking ‘bytes transferred’. It looks like this feature is on track for 2.11 (Issue 5248) but until then, I’m trying to figure this out.

It was pretty easy to add a new column to the database by adding an ActionDimension, and I tweaked ‘import_logs.py’ to send the data along in the request from log parsing. It appears that the data is getting into the database, on my new ‘transfer_bytes’ column on the ‘piwik_log_link_visit_action’ table. But now I’m stumped as to how I can report it.

It would be nice to have another column on the “Pages” (getPageUrls) report with this. Through some subclass experimenting I was able to get a column to show up, but it was empty. And the Actions reporting is quite in depth and complex, and my knowledge of PHP is limited (many years programming, but mostly in Python) so maybe I should scale back for now to something simpler:

I’d like to write a report to just show the total bandwidth used in a given time span for a site. Since this is coming from the log importer, it doesn’t need to use any real-time API stuff. Just “how much bandwidth was used this (week/month/etc)?”

Is this something I can do off of the existing datatables and archives? Or should I be writing an Archiver? Should I be looking at direct SQL manipulation or is there something in the APIs I can use to get and sum this data?