mitamirri 0.13.8 → 2.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Capfile +4 -0
- data/Gemfile +29 -0
- data/README.rdoc +6 -55
- data/Rakefile +34 -21
- data/VERSION +1 -1
- data/app/controllers/admin/tracking/reports_controller.rb +78 -0
- data/app/controllers/admin/tracking/trackable_sessions_controller.rb +7 -0
- data/app/controllers/application_controller.rb +1 -8
- data/app/controllers/trackable_actions_controller.rb +0 -2
- data/app/helpers/application_helper.rb +21 -0
- data/app/helpers/layout_helper.rb +18 -0
- data/app/models/content_report.rb +35 -0
- data/app/models/content_stat.rb +4 -0
- data/app/models/destination.rb +4 -0
- data/app/models/intersite_traffic_report.rb +47 -0
- data/app/models/keyword_stat.rb +4 -0
- data/app/models/lead.rb +3 -0
- data/app/models/lead_stat.rb +5 -0
- data/app/models/leads_report.rb +32 -0
- data/app/models/location_stat.rb +37 -0
- data/app/models/referrer_stat.rb +4 -0
- data/app/models/report.rb +83 -0
- data/app/models/stat_base.rb +11 -0
- data/app/models/trackable_action.rb +114 -91
- data/app/models/trackable_base.rb +12 -0
- data/app/models/trackable_location.rb +7 -13
- data/app/models/trackable_session.rb +255 -171
- data/app/models/trackable_stat.rb +45 -27
- data/app/models/traffic_explorer_report.rb +92 -0
- data/app/models/traffic_summary_report.rb +142 -0
- data/app/models/user_agent_stat.rb +4 -0
- data/app/models/visit.rb +6 -0
- data/app/models/visit_stat.rb +5 -0
- data/app/models/visitor.rb +4 -0
- data/app/models/visitor_profile_report.rb +23 -0
- data/app/views/admin/tracking/reports/_content.html.erb +28 -0
- data/app/views/admin/tracking/reports/_conversion_rate.html.erb +30 -0
- data/app/views/admin/tracking/reports/_criteria.html.erb +33 -0
- data/app/views/admin/tracking/reports/_entrance_pages.html.erb +29 -0
- data/app/views/admin/tracking/reports/_exit_pages.html.erb +28 -0
- data/app/views/admin/tracking/reports/_explorer_criteria.html.erb +22 -0
- data/app/views/admin/tracking/reports/_explorer_summary.html.erb +22 -0
- data/app/views/admin/tracking/reports/_intersite_destinations.html.erb +28 -0
- data/app/views/admin/tracking/reports/_intersite_referrals.html.erb +30 -0
- data/app/views/admin/tracking/reports/_leads.html.erb +30 -0
- data/app/views/admin/tracking/reports/_locations.html.erb +47 -0
- data/app/views/admin/tracking/reports/_recent_visits.html.erb +33 -0
- data/app/views/admin/tracking/reports/_referring_keywords.html.erb +28 -0
- data/app/views/admin/tracking/reports/_referring_sites.html.erb +28 -0
- data/app/views/admin/tracking/reports/_traffic_summary.html.erb +26 -0
- data/app/views/admin/tracking/reports/_user_agents.html.erb +28 -0
- data/app/views/{trackable_sessions/_visits_graph.html.erb → admin/tracking/reports/_visits_by_kind.html.erb} +3 -3
- data/app/views/admin/tracking/reports/content.html.erb +12 -0
- data/app/views/admin/tracking/reports/explorer.html.erb +13 -0
- data/app/views/admin/tracking/reports/index.html.erb +16 -0
- data/app/views/admin/tracking/reports/intersite.html.erb +11 -0
- data/app/views/admin/tracking/reports/leads.html.erb +11 -0
- data/app/views/admin/tracking/reports/summary.html.erb +16 -0
- data/app/views/admin/tracking/reports/visitor_profile.html.erb +11 -0
- data/app/views/{trackable_sessions → admin/tracking/trackable_sessions}/show.html.erb +5 -4
- data/app/views/layouts/application.html.erb +51 -18
- data/config.ru +4 -0
- data/config/application.rb +13 -0
- data/config/boot.rb +13 -110
- data/config/cucumber.yml +10 -0
- data/config/deploy.rb +40 -0
- data/config/environment.rb +4 -23
- data/config/environments/development.rb +24 -13
- data/config/environments/production.rb +41 -20
- data/config/environments/test.rb +28 -24
- data/config/initializers/formats.rb +19 -0
- data/config/initializers/metric_fu.rb +9 -0
- data/config/initializers/secret_token.rb +7 -0
- data/config/initializers/session_store.rb +3 -10
- data/config/locales/en.yml +1 -1
- data/config/mongoid.yml +19 -0
- data/config/routes.rb +16 -10
- data/features/access_reports.feature +26 -0
- data/features/step_definitions/reports_steps.rb +9 -0
- data/features/step_definitions/web_steps.rb +219 -0
- data/features/support/env.rb +32 -0
- data/features/support/hooks.rb +1 -0
- data/features/support/paths.rb +33 -0
- data/features/traffic_summary_report.feature +43 -0
- data/init.rb +0 -7
- data/lib/mitamirri.rb +9 -12
- data/lib/mitamirri/engine.rb +7 -0
- data/lib/mitamirri/helper.rb +13 -29
- data/lib/mitamirri/railtie.rb +10 -0
- data/lib/tasks/cucumber.rake +60 -0
- data/lib/tasks/rcov.rake +44 -0
- data/mitamirri.gemspec +228 -100
- data/public/404.html +26 -0
- data/public/422.html +26 -0
- data/public/500.html +26 -0
- data/{config/database.yml → public/favicon.ico} +0 -0
- data/public/images/icons/add.png +0 -0
- data/public/images/icons/collapsed.gif +0 -0
- data/public/images/icons/delete.png +0 -0
- data/public/images/icons/drag.png +0 -0
- data/public/images/icons/edit.png +0 -0
- data/public/images/icons/expanded.gif +0 -0
- data/public/images/icons/help_icon.png +0 -0
- data/public/images/icons/link_icon.png +0 -0
- data/public/images/icons/move.png +0 -0
- data/public/images/icons/move_white.png +0 -0
- data/public/images/icons/note.png +0 -0
- data/public/images/icons/note_white.png +0 -0
- data/public/images/icons/notification_icon_sprite.png +0 -0
- data/public/images/icons/spinner.gif +0 -0
- data/public/images/icons/view.png +0 -0
- data/public/images/icons/warning.png +0 -0
- data/public/images/icons/warning_2.png +0 -0
- data/public/images/icons/warning_box.png +0 -0
- data/public/images/icons/warning_icon.png +0 -0
- data/public/images/icons/warning_white.png +0 -0
- data/public/images/layout/arrow_asc.png +0 -0
- data/public/images/layout/arrow_desc.png +0 -0
- data/public/images/layout/back.png +0 -0
- data/public/images/layout/black_bar.png +0 -0
- data/public/images/layout/branding.png +0 -0
- data/public/images/layout/breadcrumb_bg.png +0 -0
- data/public/images/layout/button_bg.png +0 -0
- data/public/images/layout/content_left_bg.png +0 -0
- data/public/images/layout/content_right_bg.png +0 -0
- data/public/images/layout/footer_bg.png +0 -0
- data/public/images/layout/h1_bg.png +0 -0
- data/public/images/layout/h2_bg.png +0 -0
- data/public/images/layout/h2_bg_for_table.png +0 -0
- data/public/images/layout/header_bg_grey.png +0 -0
- data/public/images/layout/header_bg_purple.png +0 -0
- data/public/images/layout/legend_bg.png +0 -0
- data/public/images/layout/menu_box_bg.png +0 -0
- data/public/images/layout/shadow_border.png +0 -0
- data/public/images/layout/shadow_border_2.png +0 -0
- data/public/images/layout/shadow_border_3.png +0 -0
- data/public/images/layout/shadow_border_4.png +0 -0
- data/public/images/layout/tab.png +0 -0
- data/public/images/layout/tab_active.png +0 -0
- data/public/images/layout/table_header.png +0 -0
- data/public/images/layout/text_field_bg.jpg +0 -0
- data/public/images/layout/text_field_error_bg.png +0 -0
- data/public/images/layout/th_bg.png +0 -0
- data/public/images/layout/th_bg_selected.png +0 -0
- data/public/images/menu_icons/content_report.png +0 -0
- data/public/images/menu_icons/content_report_on.png +0 -0
- data/public/images/menu_icons/funnel.png +0 -0
- data/public/images/menu_icons/funnel_on.png +0 -0
- data/public/images/menu_icons/intersite_traffic.png +0 -0
- data/public/images/menu_icons/intersite_traffic_on.png +0 -0
- data/public/images/menu_icons/leads.png +0 -0
- data/public/images/menu_icons/leads_on.png +0 -0
- data/public/images/menu_icons/traffic_explorer.png +0 -0
- data/public/images/menu_icons/traffic_explorer_on.png +0 -0
- data/public/images/menu_icons/traffic_summary.png +0 -0
- data/public/images/menu_icons/traffic_summary_on.png +0 -0
- data/public/images/menu_icons/visitor_profile.png +0 -0
- data/public/images/menu_icons/visitor_profile_on.png +0 -0
- data/public/index.html +8 -0
- data/public/javascripts/application.js +2 -0
- data/public/javascripts/controls.js +965 -0
- data/public/javascripts/dragdrop.js +974 -0
- data/public/javascripts/effects.js +1123 -0
- data/public/javascripts/prototype.js +6001 -0
- data/public/javascripts/rails.js +175 -0
- data/public/robots.txt +5 -0
- data/public/stylesheets/.gitkeep +0 -0
- data/public/stylesheets/application.css +876 -0
- data/public/stylesheets/core.css +1146 -0
- data/public/stylesheets/core_ie.css +52 -0
- data/public/stylesheets/csshover3.htc +14 -0
- data/public/stylesheets/mitamirri.css +37 -724
- data/public/stylesheets/mitamirri_print.css +3 -0
- data/script/cucumber +10 -0
- data/script/rails +6 -0
- data/spec/blueprints.rb +13 -0
- data/spec/helpers/application_helper_spec.rb +23 -35
- data/spec/{lib → models}/content_report_spec.rb +12 -8
- data/spec/{lib → models}/intersite_traffic_report_spec.rb +6 -9
- data/spec/{lib → models}/leads_report_spec.rb +11 -12
- data/spec/models/location_stat_spec.rb +18 -0
- data/spec/models/trackable_action_spec.rb +46 -14
- data/spec/models/trackable_base_spec.rb +27 -0
- data/spec/models/trackable_session_spec.rb +181 -57
- data/spec/{lib/session_report_spec.rb → models/traffic_explorer_report_spec.rb} +8 -25
- data/spec/spec_helper.rb +8 -28
- data/{lib/mitamirri/tasks.rb → tasks/mitamirri.rake} +6 -7
- data/vendor/plugins/.gitkeep +0 -0
- metadata +316 -77
- data/.gitignore +0 -26
- data/app/controllers/trackable_sessions_controller.rb +0 -100
- data/app/views/trackable_sessions/_keywords_graph.html.erb +0 -24
- data/app/views/trackable_sessions/_print_buttons.html.erb +0 -3
- data/app/views/trackable_sessions/_sessions.html.erb +0 -26
- data/app/views/trackable_sessions/_top_referrers.html.erb +0 -24
- data/app/views/trackable_sessions/_traffic_summary_all.html.erb +0 -64
- data/app/views/trackable_sessions/_traffic_summary_by_kind.html.erb +0 -48
- data/app/views/trackable_sessions/content.html.erb +0 -119
- data/app/views/trackable_sessions/explorer.html.erb +0 -67
- data/app/views/trackable_sessions/export.xls.erb +0 -5
- data/app/views/trackable_sessions/index.html.erb +0 -47
- data/app/views/trackable_sessions/intersite.html.erb +0 -97
- data/app/views/trackable_sessions/leads.html.erb +0 -98
- data/app/views/trackable_sessions/visitor_profile.html.erb +0 -114
- data/config/initializers/backtrace_silencers.rb +0 -7
- data/config/initializers/database.rb +0 -1
- data/config/initializers/inflections.rb +0 -10
- data/config/initializers/mime_types.rb +0 -5
- data/config/initializers/new_rails_defaults.rb +0 -21
- data/db/development.sqlite3 +0 -0
- data/db/migrate/20100810173533_create_trackable_sessions.rb +0 -23
- data/db/migrate/20100810173605_create_trackable_actions.rb +0 -20
- data/db/test.sqlite3 +0 -1
- data/lib/mitamirri/content_report.rb +0 -75
- data/lib/mitamirri/intersite_traffic_report.rb +0 -122
- data/lib/mitamirri/leads_report.rb +0 -90
- data/lib/mitamirri/session_report.rb +0 -219
- data/lib/mitamirri/stat_report.rb +0 -216
- data/lib/mitamirri/visitor_profile_report.rb +0 -127
- data/script/about +0 -4
- data/script/console +0 -3
- data/script/dbconsole +0 -3
- data/script/destroy +0 -3
- data/script/generate +0 -3
- data/script/performance/benchmarker +0 -3
- data/script/performance/profiler +0 -3
- data/script/plugin +0 -3
- data/script/runner +0 -3
- data/script/server +0 -3
- data/spec/controllers/trackable_actions_controller_spec.rb +0 -5
- data/spec/controllers/trackable_sessions_controller_spec.rb +0 -5
- data/spec/custom_matchers.rb +0 -23
- data/spec/lib/stat_report_spec.rb +0 -106
- data/spec/rcov.opts +0 -4
- data/spec/schema.rb +0 -34
- data/spec/spec.opts +0 -4
data/Capfile
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
source 'http://jose.seologic.com:8808/'
|
3
|
+
|
4
|
+
gem 'bantik-user-agent', :require => 'user-agent'
|
5
|
+
gem 'bson_ext'
|
6
|
+
gem 'geokit'
|
7
|
+
gem 'mongoid'
|
8
|
+
gem 'rails', '>= 3.0.1'
|
9
|
+
gem 'pdfkit'
|
10
|
+
gem 'scaffold_logic'
|
11
|
+
gem 'seer'
|
12
|
+
gem 'SystemTimer'
|
13
|
+
|
14
|
+
group :development do
|
15
|
+
gem 'jeweler'
|
16
|
+
end
|
17
|
+
|
18
|
+
group :test do
|
19
|
+
gem 'be_valid_asset'
|
20
|
+
gem 'capybara'
|
21
|
+
gem 'cucumber-rails'
|
22
|
+
gem 'database_cleaner'
|
23
|
+
gem 'faker'
|
24
|
+
gem 'launchy'
|
25
|
+
gem 'machinist_mongo', :require => 'machinist/mongoid'
|
26
|
+
gem 'metric_fu'
|
27
|
+
gem 'mocha'
|
28
|
+
gem 'rspec-rails'
|
29
|
+
end
|
data/README.rdoc
CHANGED
@@ -1,45 +1,13 @@
|
|
1
1
|
= mitamirri
|
2
2
|
|
3
|
-
Mitamirri is
|
4
|
-
|
5
|
-
It's a Rails engine designed to be a drop-in substitute for (or companion to) Google Analytics that allows tracking of custom user events at a very granular level (e.g. specific link or button clicks and even mouseovers) in addition to the standard visits, etc. It uses MongoDB on the backend for optimal performance, even with hundreds of thousands of visits, and to stay out of the way of your application's database.
|
3
|
+
Mitamirri is a Rails engine designed to be a drop-in substitute for (or companion to) Google Analytics that allows tracking of custom user events at a very granular level (e.g. specific link or button clicks and even mouseovers) in addition to the standard visits, etc.
|
6
4
|
|
7
5
|
== Installation
|
8
6
|
|
9
|
-
* Make sure that you have MongoDB installed and configured for your environment.
|
10
|
-
|
11
|
-
* See http://www.mongodb.org/display/DOCS/Quickstart
|
12
|
-
|
13
|
-
* For the development environment, this OSX-specific installation guide is useful: http://shiftcommathree.com/articles/how-to-install-mongodb-on-os-x
|
14
|
-
|
15
|
-
* Install the mongo_mapper:
|
16
|
-
|
17
|
-
gem install mongo_mapper
|
18
|
-
|
19
|
-
* Install mongo_mapper's dependency:
|
20
|
-
|
21
|
-
gem install bson_ext
|
22
|
-
|
23
|
-
* Make sure that you have the Jeweler gem installed:
|
24
|
-
|
25
|
-
gem install jeweler
|
26
|
-
|
27
|
-
* Install the gem. From the Mitamirri repo:
|
28
|
-
|
29
|
-
rake install
|
30
|
-
|
31
7
|
* Add the following lines to your config/environment.rb file:
|
32
8
|
|
33
|
-
config.gem 'bantik-user-agent', :lib => 'user-agent'
|
34
9
|
config.gem 'mitamirri'
|
35
|
-
config.gem 'mongo_mapper'
|
36
|
-
config.gem 'pdfkit'
|
37
|
-
config.gem 'seer'
|
38
10
|
|
39
|
-
* Add the following line to your application's Rakefile:
|
40
|
-
|
41
|
-
require 'mitamirri/tasks'
|
42
|
-
|
43
11
|
* Add this to the top of your app/helpers/application_helper.rb file:
|
44
12
|
|
45
13
|
include Mitamirri::Helper
|
@@ -48,28 +16,15 @@ It's a Rails engine designed to be a drop-in substitute for (or companion to) Go
|
|
48
16
|
|
49
17
|
rake mitamirri:install
|
50
18
|
|
51
|
-
* Update the database name in config/initializers/database.rb with the name of your application. Be sure to remove the timestamp from the database name!
|
52
|
-
|
53
19
|
* If you want to override default behaviour (strongly recommended, to at least require authorization for accessing reports), run the following rake command to copy Mitamirri's views and controllers to your application for customization:
|
54
20
|
|
55
21
|
rake mitamirri:override
|
56
22
|
|
57
|
-
* Mitamirri
|
58
|
-
|
59
|
-
config.gem 'pdfkit'
|
60
|
-
config.gem 'geokit'
|
61
|
-
config.gem 'user-agent'
|
62
|
-
config.gem 'bantik-user-agent', :lib => 'user-agent'
|
63
|
-
config.middleware.use "PDFKit::Middleware", :print_media_type => true
|
23
|
+
* Include Mitamirri's CSS in your admin layout:
|
64
24
|
|
65
|
-
|
66
|
-
|
67
|
-
.page_break { display: block; text-align: center; margin-top: 2em; page-break-after: always; }
|
25
|
+
<link href="/stylesheets/mitamirri.css" media="all" rel="stylesheet" type="text/css" />
|
26
|
+
<link href="/stylesheets/mitamirri_print.css" media="print" rel="stylesheet" type="text/css" />
|
68
27
|
|
69
|
-
And the following to your screen style sheet:
|
70
|
-
|
71
|
-
.page_break { display: none; }
|
72
|
-
|
73
28
|
== Configuring Tracking
|
74
29
|
|
75
30
|
* To track pageviews, add this anywhere in the HTML body of your view (or layout) file:
|
@@ -98,15 +53,11 @@ It's a Rails engine designed to be a drop-in substitute for (or companion to) Go
|
|
98
53
|
|
99
54
|
== Accessing Reports
|
100
55
|
|
101
|
-
To view reports and session details, point your browser to http://localhost:3000/tracking/
|
56
|
+
To view reports and session details, point your browser to http://localhost:3000/admin/tracking/
|
102
57
|
|
103
58
|
== Development Tips
|
104
59
|
|
105
|
-
* To run specs, use
|
106
|
-
|
107
|
-
* If you're just changing views, run rake:install from your local Mitamirri directory and updates will appear in your host application immediately.
|
108
|
-
|
109
|
-
* If you're changing models, run rake:install and then restart your host application.
|
60
|
+
* To run specs, use rspec spec/
|
110
61
|
|
111
62
|
* If you add features, run rake version:bump:minor to adjust the version number accordingly.
|
112
63
|
|
data/Rakefile
CHANGED
@@ -1,26 +1,39 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
#require(File.join(File.dirname(__FILE__), 'config', 'boot'))
|
5
|
-
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
require 'metric_fu'
|
6
4
|
require 'rake'
|
7
|
-
require '
|
8
|
-
require '
|
5
|
+
require 'jeweler'
|
6
|
+
require File.expand_path('../config/application', __FILE__)
|
7
|
+
|
8
|
+
Mitamirri::Application.load_tasks
|
9
9
|
|
10
10
|
begin
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
gemspec.description = "View and action tracking for Rails 2.x."
|
17
|
-
gemspec.email = "corey@seologic.com"
|
18
|
-
gemspec.homepage = "http://github.com/Bantik/mitamarri"
|
19
|
-
gemspec.authors = ["Corey Ehmke"]
|
20
|
-
gemspec.test_files = []
|
21
|
-
end
|
22
|
-
Jeweler::GemcutterTasks.new
|
23
|
-
rescue LoadError
|
24
|
-
puts "Jeweler not available. Install it with: gem install jeweler"
|
11
|
+
Bundler.setup(:default, :development)
|
12
|
+
rescue Bundler::BundlerError => e
|
13
|
+
$stderr.puts e.message
|
14
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
15
|
+
exit e.status_code
|
25
16
|
end
|
26
17
|
|
18
|
+
Jeweler::Tasks.new do |gem|
|
19
|
+
gem.name = "mitamirri"
|
20
|
+
gem.homepage = "http://github.com/ivanoblomov/mitamirri"
|
21
|
+
gem.summary = %Q{Analytics for Rails 3 applications.}
|
22
|
+
gem.description = %Q{Mitamirri is a Rails engine designed to be a drop-in substitute for (or companion to) Google Analytics that enables standard analytics tracking in addition to tracking of custom client-side events.}
|
23
|
+
gem.email = "rod@seologic.com"
|
24
|
+
gem.authors = ["Bantik"]
|
25
|
+
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
26
|
+
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
27
|
+
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
28
|
+
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
29
|
+
end
|
30
|
+
Jeweler::RubygemsDotOrgTasks.new
|
31
|
+
|
32
|
+
require 'rake/rdoctask'
|
33
|
+
Rake::RDocTask.new do |rdoc|
|
34
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
35
|
+
rdoc.rdoc_dir = 'rdoc'
|
36
|
+
rdoc.title = "mitamirri #{version}"
|
37
|
+
rdoc.rdoc_files.include('README*')
|
38
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
39
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
2.0.8
|
@@ -0,0 +1,78 @@
|
|
1
|
+
class Admin::Tracking::ReportsController < ApplicationController
|
2
|
+
|
3
|
+
Mime::Type.register "application/vnd.ms-excel", :xls
|
4
|
+
|
5
|
+
before_filter :configure_options
|
6
|
+
|
7
|
+
# RESTful
|
8
|
+
|
9
|
+
def index
|
10
|
+
end
|
11
|
+
|
12
|
+
# Custom
|
13
|
+
|
14
|
+
def content
|
15
|
+
@report = ContentReport.new(params)
|
16
|
+
if @report.ready?
|
17
|
+
@pages_series = @report.pages_series(params)
|
18
|
+
@entrance_pages_series = @report.entrance_pages_series(params)
|
19
|
+
@exit_pages_series = @report.exit_pages_series(params)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def explorer
|
24
|
+
params[:visit_kind] = nil if params[:visit_kind] == 'total'
|
25
|
+
@report = TrafficExplorerReport.new(params)
|
26
|
+
if @report.ready?
|
27
|
+
@visits = @report.visits(params)
|
28
|
+
@visits_series = @visits.map{|v| v.stats}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def export
|
33
|
+
end
|
34
|
+
|
35
|
+
def intersite
|
36
|
+
@report = IntersiteTrafficReport.new(params)
|
37
|
+
if @report.ready?
|
38
|
+
@total_visits = @report.total_visits(params)
|
39
|
+
@total_visits_series = @total_visits.map{|v| v.stats}
|
40
|
+
@destinations_series = @report.destinations(params)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def leads
|
45
|
+
@report = LeadsReport.new(params)
|
46
|
+
if @report.ready?
|
47
|
+
@leads = @report.leads(params)
|
48
|
+
@leads_series = @leads.map{|l| l.stats}
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def summary
|
53
|
+
@report = TrafficSummaryReport.new(params)
|
54
|
+
if @report.ready?
|
55
|
+
@keywords_series = @report.keywords_by_frequency(params)
|
56
|
+
@referrers_series = @report.top_referrers(params)
|
57
|
+
@visits = @report.visits(params)
|
58
|
+
@visits_series = @visits.map{|v| v.stats}
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def visitor_profile
|
63
|
+
@report = VisitorProfileReport.new(params)
|
64
|
+
if @report.ready?
|
65
|
+
@user_agents_series = @report.user_agents_by_frequency(params)
|
66
|
+
@locations_series = @report.locations_by_frequency(params)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
private
|
71
|
+
|
72
|
+
def configure_options
|
73
|
+
@sites = (TrackableStat.sites + ["All Sites"]).sort
|
74
|
+
@time_periods = ["Past 3 Months", "Past 6 Months", "Past 12 Months"]
|
75
|
+
params[:time_period] ||= @time_periods.first
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
@@ -1,10 +1,3 @@
|
|
1
|
-
# Filters added to this controller apply to all controllers in the application.
|
2
|
-
# Likewise, all the methods added will be available for all controllers.
|
3
|
-
|
4
1
|
class ApplicationController < ActionController::Base
|
5
|
-
|
6
|
-
protect_from_forgery # See ActionController::RequestForgeryProtection for details
|
7
|
-
|
8
|
-
# Scrub sensitive parameters from your log
|
9
|
-
# filter_parameter_logging :password
|
2
|
+
protect_from_forgery
|
10
3
|
end
|
@@ -1,2 +1,23 @@
|
|
1
1
|
module ApplicationHelper
|
2
|
+
|
3
|
+
def breadcrumbs
|
4
|
+
html = %{<ol class="breadcrumbs">}
|
5
|
+
|
6
|
+
# Top-level
|
7
|
+
html << content_tag(:li, link_to('Home', root_path)) if defined?(root_path)
|
8
|
+
html << content_tag(:li, link_to('Tracking', admin_tracking_root_path))
|
9
|
+
html << content_tag(:li, link_to("Traffic Summary", admin_tracking_summary_path)) if controller?('tracking') && action?('summary')
|
10
|
+
html << content_tag(:li, link_to("Intersite Traffic", admin_tracking_foo_path)) if controller?('tracking') && action?('foo')
|
11
|
+
html << content_tag(:li, link_to("Traffic Explorer", admin_tracking_explorer_path)) if controller?('tracking') && action?('explorer')
|
12
|
+
html << content_tag(:li, link_to("Top Content", admin_tracking_content_path)) if controller?('tracking') && action?('content')
|
13
|
+
html << content_tag(:li, link_to("Leads", admin_tracking_leads_path)) if controller?('tracking') && action?('leads')
|
14
|
+
html << content_tag(:li, link_to("Visitor Profile", admin_tracking_visitor_profile_path)) if controller?('tracking') && action?('visitor_profile')
|
15
|
+
|
16
|
+
# Tidy up
|
17
|
+
html << %{</ol>}
|
18
|
+
|
19
|
+
# Output that puppy.
|
20
|
+
html.html_safe
|
21
|
+
|
22
|
+
end
|
2
23
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module LayoutHelper
|
2
|
+
include ScaffoldLogic::FormHelper
|
3
|
+
include ScaffoldLogic::Helper
|
4
|
+
include ScaffoldLogic::TabInterfaceHelper
|
5
|
+
include ScaffoldLogic::MenuHelper
|
6
|
+
|
7
|
+
def set_title(title = nil, window_title = nil)
|
8
|
+
app_name ||= 'SEO Logic'
|
9
|
+
window_title ||= title
|
10
|
+
if title.nil?
|
11
|
+
content_for(:title) { app_name }
|
12
|
+
content_for(:page_title) { }
|
13
|
+
else
|
14
|
+
content_for(:title) { window_title + " - #{app_name}" }
|
15
|
+
content_for(:page_title) { title }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class ContentReport < Report
|
2
|
+
|
3
|
+
# Initialization =================================================================================
|
4
|
+
|
5
|
+
def ready?
|
6
|
+
self.site && self.time_period && self.visit_kind
|
7
|
+
end
|
8
|
+
|
9
|
+
def stats
|
10
|
+
if multiple_sites?
|
11
|
+
@stats ||= TrackableStat.for_date_range(start_date, end_date)
|
12
|
+
else
|
13
|
+
@stats ||= TrackableStat.for_site(site).for_date_range(start_date, end_date)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def wants_traffic_kind?
|
18
|
+
true
|
19
|
+
end
|
20
|
+
|
21
|
+
# Graph data =====================================================================================
|
22
|
+
|
23
|
+
def pages_series(args)
|
24
|
+
TrackableAction.pages_histogram(args).map{|datum| ContentStat.new(:url => datum[0], :views => datum[1].to_i)}
|
25
|
+
end
|
26
|
+
|
27
|
+
def entrance_pages_series(args)
|
28
|
+
TrackableSession.entrance_pages_histogram(args).map{|datum| ContentStat.new(:url => datum[0], :views => datum[1].to_i)}
|
29
|
+
end
|
30
|
+
|
31
|
+
def exit_pages_series(args)
|
32
|
+
TrackableSession.exit_pages_histogram(args).map{|datum| ContentStat.new(:url => datum[0], :views => datum[1].to_i)}
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
class IntersiteTrafficReport < Report
|
2
|
+
|
3
|
+
# Initialization =================================================================================
|
4
|
+
|
5
|
+
def ready?
|
6
|
+
self.site && self.time_period && self.visit_kind
|
7
|
+
end
|
8
|
+
|
9
|
+
def destination_histogram(args)
|
10
|
+
@destination_histogram ||= TrackableSession.clickthroughs_histogram(args)
|
11
|
+
end
|
12
|
+
|
13
|
+
def destination_sites(args)
|
14
|
+
self.destination_histogram(args).keys
|
15
|
+
end
|
16
|
+
|
17
|
+
# Graph data =====================================================================================
|
18
|
+
|
19
|
+
def total_visits(args)
|
20
|
+
[Visit.new(:stats => visit_stats(args))]
|
21
|
+
end
|
22
|
+
|
23
|
+
def total_visit_stats(args)
|
24
|
+
_visit_stats = []
|
25
|
+
dates_by_week.each do |date|
|
26
|
+
_visit_stats << VisitStat.new(:date => date, :clickthroughs => TrackableSession.search_without_date(args).for_week(date).with_clickthroughs.count)
|
27
|
+
end
|
28
|
+
_visit_stats
|
29
|
+
end
|
30
|
+
|
31
|
+
def destinations(args)
|
32
|
+
_destinations = []
|
33
|
+
self.destination_sites(args).each do |site|
|
34
|
+
_destinations << Destination.new(:site => site, :clickthroughs => self.sessions.with_clickthroughs.count)
|
35
|
+
end
|
36
|
+
_destinations
|
37
|
+
end
|
38
|
+
|
39
|
+
def visit_stats(args)
|
40
|
+
_visit_stats = []
|
41
|
+
dates_by_week.each do |date|
|
42
|
+
_visit_stats << VisitStat.new(:date => date, :clickthroughs => TrackableSession.search_without_date(args).for_week(date).with_clickthroughs.count)
|
43
|
+
end
|
44
|
+
_visit_stats
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|