cirandas.net

ref: master

plugins/piwik/lib/piwik_plugin.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class PiwikPlugin < Noosfero::Plugin

  include ActionView::Helpers::JavaScriptHelper
  include ActionView::Helpers::FormHelper
  include ActionView::Helpers::UrlHelper
  include ActionView::Helpers::TagHelper

  def self.plugin_name
    "Piwik"
  end

  def self.plugin_description
    _("Tracking and web analytics to your Noosfero's environment")
  end

  def body_ending
    domain = environment.piwik_domain
    site_id = environment.piwik_site_id
    unless domain.blank? || site_id.blank?
      piwik_url = "#{domain}/#{context.environment.piwik_path}"
      piwik_url = "#{piwik_url}/" unless piwik_url.end_with?('/')
      expanded_template('tracking-code.rhtml', {:site_id => site_id, :piwik_url => piwik_url})
    end
  end

end