Piwik API - Downloads & Custom Variables

Hello,

I’ve developed a module for Indico software which interfaces with Piwik for statistics tracking. I am currently attempting to link a download listener on the serverside to accomplish this, it is working fine however I wish to obtain ‘top 5’ downloads for any given day and, specifically, a segment.

I am using custom variables when generating the request which logs the download via the cvar parameter as follows:


https://192.168.56.101/piwik/piwik.php?cvar=%7B%221%22%3A+%5B%22DownloadConferenceID%22%2C+%22137976%22%5D%7D&url=https%3A//pcituds06.cern.ch/indico/getFile.py/access%3FcontribId%3D2%26resId%3D0%26materialId%3Dslides%26confId%3D137967&h=15&m=59&action_name=foobar&s=3&idsite=1&token_auth=bbfc55f52c5b9bda2f8c41542f83820b&download=https%3A//pcituds06.cern.ch/indico/getFile.py/access%3FcontribId%3D2%26resId%3D0%26materialId%3Dslides%26confId%3D137967&rec=1

This returns the following, and registers as a successful hit on the downloads when getDownload() is triggered against it:


Page level Custom Variables: 
array (
  'custom_var_k1' => 'DownloadConferenceID',
  'custom_var_v1' => '137976',
)
array (
  'idvisit' => '73',
  'idsite' => 1,
  'idvisitor' => 'ÁCÃø`Ç
',
  'server_time' => '2012-06-13 14:10:10',
  'idaction_url' => 55,
  'idaction_url_ref' => '55',
  'idaction_name_ref' => '0',
  'time_spent_ref_action' => 576,
  'custom_var_k1' => 'DownloadConferenceID',
  'custom_var_v1' => '137976',
)

The issue is, using Action.getDownloads() I can’t find the correct combination of customVariablePageName1 & value etc to retrieve all the downloads where the value of the name and number match those which I sent over, I am attempting to get only that subset of data.

My only conclusion is that the action of a download isn’t bound to custom variables in the same manner in which page views are, unless there is something which I am missing.

If you can see the solution for this, I’d be most grateful for any assistance offered.

Note: Piwik IP & token_auth in URLs are within local scope only.

did you check in the table piwik_log_link_visit_action to see if the custom var are set properly for your download?

What URL request including segment did you test that didnt work?

Happy New Year! If you are still using Piwik and interested in the awesome new feature of “Creating a Custom Segment in Piwik and apply to reports in Real time!” we need YOUR help, with a little or big donation at: http://crowdfunding.piwik.org/custom-segments-editor/

This will allow to dynamically add or edit, a new set of rules for example “Show all visitors from USA and using Firefox and using Google”. This will be done via a simple to use interface. See screenshots and more info here: http://crowdfunding.piwik.org/custom-segments-editor/

We are crowd funding the future of Piwik and this feature in particular. With your help we can do it.

Thanks

Matthieu