Very Custom Tracking (need help)

First let me say I am pretty new to piwik and to site analytic at all. Secondly might be doing this completely wrong but hey please correct me.

Let me try to explain first what i want to do then how i plan to do it and finally the question is the point i am stuck at.

I am importing logs from several servers. Apart from the standard data for each log line i have 2 additional columns (pieces of data) that are actually 2 numbers: NumBytes and TimeInSec. What I want to do with this data is to generate reports to track the sum of NumBytes and the sum of TimeInSec by some custom segmentation (the standard way to filter the results in piwik i guess).

Now those 2 additional fields are not supported in piwik so I have decided to create 2 Custom Variables called Bytes and Sec and put the values for each log line there. So far so good. The data is feed perfectly to the DB… and this is where i am stuck. I have an idea that I can use custom SQL query that can do exactly what I plan to do, however the segmentation gets in my way. I would like to use the segmentation api provided by piwik to filter the results but if i use a custom SQL query I would probably need to generate the query using the segmentation values, which sound messy to me, trying to reimplement the segmentation parsing and query generation.


  1. How do I cover the use cases:
    [li] Give me the sum of NumBytes for segmentation==(*custom segmentation)
    [/li][li] Give me the average of TimeInSec for segmentation==(*custom segmentation)
  2. Is it possible for me to use custom data when archiving so that the sum can be archived along the other statistics

Please dont flame me if i got some stuff wrong I repeat I am fairly new to all this.

If anyone can help I will be very grateful.

Thanks in Advance,