Class Piwik::Site
In: lib/piwik/site.rb
Parent: Piwik::Base
ArgumentError UnknownUser MissingConfiguration UnknownSite StandardError ApiError Base User Site VERSION Piwik dot/f_5.png

Methods

Attributes

config  [R] 
created_at  [R] 
id  [R] 
main_url  [RW] 
name  [RW] 

Public Class methods

Returns an instance of Piwik::Site representing the site identified by the supplied site_id. Raises a Piwik::ApiError if the site doesn‘t exists or if the user associated with the supplied auth_token does not have at least ‘view’ access to the site.

You can pass the URL for your Piwik install and an authorization token as the second and third parameters. If you don‘t, than it will try to find them in a ’~/.piwik‘ (and create the file with an empty template if it doesn‘t exists).

Initializes a new Piwik::Site object, with the supplied attributes.

You can pass the URL for your Piwik install and an authorization token as the second and third parameters. If you don‘t, than it will try to find them in a ’~/.piwik‘ (and create the file with an empty template if it doesn‘t exists).

Valid (and required) attributes are:

  • :name - the site‘s name
  • :main_url - the site‘s url

Public Instance methods

Returns the amount of actions (pageviews) for the current site, filtered by the supplied period and date.

  • period should be one of :day, :week, :month or :year (default: :day)
  • date should be a Date object (default: Date.today)

Equivalent Piwik API call: VisitsSummary.getActions (idSite, period, date)

Saves the current new site in Piwik.

Equivalent Piwik API call: SitesManager.addSite (siteName, urls)

Deletes the current site from Piwik.

Equivalent Piwik API call: SitesManager.deleteSite (idSite)

Gives read and write access (‘admin‘) for the supplied user login for the current site.

Removes all access (gives an ‘noaccess‘) for the supplied user login for the current site.

Gives read access (‘view‘) to the supplied user login for the current site.

Returns true if the current site does not exists in the Piwik yet.

pageviews(period=:day, date=Date.today)

Alias for actions

remove_access_from(login)

Alias for give_no_access_to

Saves the current site in Piwik.

Calls create it it‘s a new site, update otherwise.

Returns a hash with a summary of access information for the current site (visits, unique visitors, actions / pageviews, maximum actions per visit, bounces and total time spent in all visits in seconds), filtered by the supplied period and date.

  • period should be one of :day, :week, :month or :year (default: :day)
  • date should be a Date object (default: Date.today)

Equivalent Piwik API call: VisitsSummary.get (idSite, period, date)

Returns the amount of unique visitors for the current site, filtered by the supplied period and date.

  • period should be one of :day, :week, :month or :year (default: :day)
  • date should be a Date object (default: Date.today)

Equivalent Piwik API call: VisitsSummary.getUniqueVisitors (idSite, period, date)

Saves the current site in Piwik, updating it‘s data.

Equivalent Piwik API call: SitesManager.updateSite (idSite, siteName, urls)

Returns the amount of visits for the current site, filtered by the supplied period and date.

  • period should be one of :day, :week, :month or :year (default: :day)
  • date should be a Date object (default: Date.today)

Equivalent Piwik API call: VisitsSummary.getVisits (idSite, period, date)

[Validate]