Giter Club home page Giter Club logo

simple-piwik's Introduction

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

simple-piwik's People

Contributors

riopro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.