Class: Concen::TrafficsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Concen::TrafficsController
- Defined in:
- app/controllers/concen/traffics_controller.rb
Instance Method Summary collapse
- #pages ⇒ Object
- #referrals ⇒ Object
-
#show ⇒ Object
Supports OS X and Linux, require top command.
- #visits_counts ⇒ Object
Instance Method Details
#pages ⇒ Object
27 28 29 30 31 32 |
# File 'app/controllers/concen/traffics_controller.rb', line 27 def pages @pages_stats = Visit::Page.aggregate_count_by_url(:limit => 6) respond_to do |format| format.html { render :partial => "concen/traffics/pages" } end end |
#referrals ⇒ Object
34 35 36 37 38 39 |
# File 'app/controllers/concen/traffics_controller.rb', line 34 def referrals @referrals_stats = Visit::Referral.aggregate_count_by_domain(:limit => 6) respond_to do |format| format.html { render :partial => "concen/traffics/referrals" } end end |
#show ⇒ Object
Supports OS X and Linux, require top command.
@current_month_visits = Statistic.visits_for_current :month
Real time visits Historical statistics Month: visits
10 11 12 |
# File 'app/controllers/concen/traffics_controller.rb', line 10 def show @page_title = "Traffic" end |
#visits_counts ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/concen/traffics_controller.rb', line 14 def visits_counts if @stats = Visit::Page.aggregate_count_by_time(:hour => params[:hour], :precision => "millisecond") # Readjust timestamp because flot graph doesn't handle time zone. @stats.map! do |s| time = Time.zone.at s[0]/1000 [(time.utc.to_i + time.utc_offset)*1000, s[1]] end end respond_to do |format| format.json { render :json => @stats } end end |