Skip to content


autometal-piwik is now the official ruby client for the Piwik project. You can look at the code at its new home here.gem version

This gem implements a straightforward client for the whole Piwik API. There are two main interfaces made available to developers:

  • The Site::Piwik wrapper class. Allows you to do stuff like

    Not every method is implemented on the wrapper as it is time consuming to evaluate each method and re-implement it in a ruby-friendly manner. Help is always welcome ;).
    The spec file is the most up-to-date wrapper method list.

  • The ‘native’ API. Basically, it implements every API module almost verbatim.
    Example implementing a Live module function:

    Piwik::Live.getCounters(:idSite => 7, :lastMinutes => 5, :segment => '')
    => #<Piwik::Live::Counters @data={"3", "actions"=>"4", "visitsConverted"=>"0"}>

Version 1.0.0 also introduces a piwik-console that allows direct connection to a Piwik install.
Try it out on the official Piwik demo server:

$ piwik-console -u -t anonymous
:001 > s = Site.load(7).visits.summary(:date => :yesterday)
:002 > s.nb_uniq_visitors
=> 517

Related webpages:

Comment Feed

No Responses (yet)

Some HTML is OK

or, reply to this post via trackback.