0.01
No commit activity in last 3 years
No release in over 3 years
Provides simple access to the Piwik API.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

>= 1.4.6
>= 1.6.1
 Project Readme

simple-piwik¶ ↑

A client for the Piwik API compatible with Rails 3.x

require 'rubygems'
require 'piwik'
Piwik.auth_token = "i need to configure simple-piwik with my auth_token here"
Piwik.piwik_url = "http://piwik.mypiwikdomain.org"
site = Piwik::Site.load(1)
=> #<Piwik::Site:0xb36ax935 @name="Examples.com", @config={:auth_token=>"my_auth_key", :piwik_url=>"http://piwik.mypiwikdomain.org"}, @id=1, @main_url="http://www.examples.com", @created_at=Thu Oct 20 22:55:42 +0100 2023>
site.pageviews(:month, Date.today)
=> 3002378
user = Piwik::User.load(1, 'http://piwik.mypiwikdomain.org', 'my_auth_key')
=> #<Piwik::User:0xa108ac955 @login="Examples.com", @config={:auth_token=>"my_auth_key", :piwik_url=>"http://piwik.mypiwikdomain.org"}, @id=1, @main_url="http://www.examples.com", @created_at=Thu Oct 20 22:55:43 -0100 2023>

Configuring with initializer config/initializers/simple-piwik.rb :

if Rails.env.production? 
  Piwik.piwik_url  = "http://piwik.mypiwikdomain.org"
  Piwik.auth_token = "2ad590308b1efa590a9a43ad86d3ac1s"
elsif Rails.env.development?
  #this is currently set to the same as production
  Piwik.piwik_url  = "http://piwik.mypiwikdomain.org"
  Piwik.auth_token = "2ad590308b1efa590a9a43ad86d3ac1s"
end

Piwik website (piwik.org)

Piwik API reference (dev.piwik.org/trac/wiki/API/Reference)

REQUIREMENTS:¶ ↑

activesupport, rest-client, json

INSTALL:¶ ↑

gem install simple-piwik