Class: Matomo::Referrer
- Inherits:
-
Object
- Object
- Matomo::Referrer
- Defined in:
- lib/matomo.rb
Instance Attribute Summary collapse
-
#label ⇒ Object
Returns the value of attribute label.
-
#visits ⇒ Object
Returns the value of attribute visits.
Class Method Summary collapse
Instance Method Summary collapse
- #actions_per_visit ⇒ Object
-
#initialize(params) ⇒ Referrer
constructor
A new instance of Referrer.
Constructor Details
#initialize(params) ⇒ Referrer
11 12 13 14 15 |
# File 'lib/matomo.rb', line 11 def initialize(params) @label = params["label"] @visits = params["nb_visits"] @actions = params["nb_actions"] end |
Instance Attribute Details
#label ⇒ Object
Returns the value of attribute label.
9 10 11 |
# File 'lib/matomo.rb', line 9 def label @label end |
#visits ⇒ Object
Returns the value of attribute visits.
9 10 11 |
# File 'lib/matomo.rb', line 9 def visits @visits end |
Class Method Details
.top ⇒ Object
22 |
# File 'lib/matomo.rb', line 22 def self.top() where end |
.where(**args) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/matomo.rb', line 24 def self.where(**args) params = { method: "Referrers.getAll" }.merge( Matomo.date_range_params(args[:start_date], args[:end_date]) ) if args[:path] params[:segment] = "pageUrl==#{Matomo.tracked_site_url}#{args[:path]}" end resp = Matomo.get(params) return [] if resp.response.code != "200" resp.map{ |x| new(x) } end |
Instance Method Details
#actions_per_visit ⇒ Object
17 18 19 20 |
# File 'lib/matomo.rb', line 17 def actions_per_visit return 0 unless @actions and @visits (@actions/@visits.to_f).round(1) end |