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/script/cucumber
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
|
4
|
+
if vendored_cucumber_bin
|
5
|
+
load File.expand_path(vendored_cucumber_bin)
|
6
|
+
else
|
7
|
+
require 'rubygems' unless ENV['NO_RUBYGEMS']
|
8
|
+
require 'cucumber'
|
9
|
+
load Cucumber::BINARY
|
10
|
+
end
|
data/script/rails
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|
data/spec/blueprints.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'machinist/mongoid'
|
2
|
+
require 'sham'
|
3
|
+
require 'faker'
|
4
|
+
|
5
|
+
TrackableStat.blueprint do
|
6
|
+
site { 'www.seologic.com' }
|
7
|
+
end
|
8
|
+
|
9
|
+
TrackableSession.blueprint do
|
10
|
+
ip_address { '192.1.1.5' }
|
11
|
+
initial_request_url { 'http://www.seologic.com/foo.htm?gclid=1234' }
|
12
|
+
referrer { 'http://www.foo.com/' }
|
13
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
-
require 'mitamirri'
|
3
|
-
include Mitamirri::Helper
|
4
2
|
|
5
|
-
|
6
|
-
|
3
|
+
require 'lib/mitamirri'
|
4
|
+
|
5
|
+
describe Mitamirri::Helper do
|
6
|
+
|
7
7
|
describe 'track action' do
|
8
|
-
|
8
|
+
|
9
9
|
it 'creates a trackable action object from view tracking invocation' do
|
10
10
|
request = Object.new
|
11
11
|
request.stubs(:referrer).returns('/')
|
@@ -14,44 +14,32 @@ describe "application helper methods" do
|
|
14
14
|
session = Object.new
|
15
15
|
session.stubs(:session_id).returns('1234ab')
|
16
16
|
lambda{
|
17
|
-
track_action('view', :label => 'Some Label')
|
17
|
+
helper.track_action('view', :label => 'Some Label')
|
18
18
|
}.should change(TrackableAction, :count).by(1)
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'returns track click code for click tracking invocation' do
|
22
|
-
request = Object.new
|
23
|
-
request.stubs(:referrer).returns('/')
|
24
|
-
request.stubs(:remote_ip).returns('123.123.123.123')
|
25
|
-
request.stubs(:url).returns('http://www.elizium.com/opiates')
|
22
|
+
@request = Object.new
|
23
|
+
@request.stubs(:referrer).returns('/')
|
24
|
+
@request.stubs(:remote_ip).returns('123.123.123.123')
|
25
|
+
@request.stubs(:url).returns('http://www.elizium.com/opiates')
|
26
26
|
session = Object.new
|
27
27
|
session.stubs(:session_id).returns('1234ab')
|
28
|
-
track_action('click').should_not be_nil
|
28
|
+
helper.track_action('click').should_not be_nil
|
29
29
|
end
|
30
|
-
|
31
|
-
it 'needs more robust tests for this method'
|
32
|
-
|
30
|
+
|
33
31
|
end
|
34
|
-
|
32
|
+
|
35
33
|
it 'returns appropriate track_click_code' do
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
track_event_code('click', 'mousedown', 'my_button', 'my_action', '/', '123.123.123.123', 'www.seologic.com', '/', 'asdf').should == expected
|
34
|
+
results = track_event_code('click', 'mousedown', 'my_button', 'my_action', '/', '123.123.123.123', 'www.seologic.com', '/', 'asdf')
|
35
|
+
results =~ /kind=click/
|
36
|
+
results =~ /Event.observe('my_button', 'mousedown', track_mousedown_my_button_event);/
|
37
|
+
results =~ /label=my_action/
|
38
|
+
results =~ /referrer=\//
|
39
|
+
results =~ /remote_ip=123.123.123.123/
|
40
|
+
results =~ /site=www.seologic.com/
|
41
|
+
results =~ /url=\//
|
42
|
+
results =~ /destination=asdf/
|
46
43
|
end
|
47
|
-
|
48
|
-
it 'returns a legend tag' do
|
49
|
-
legend_tag('Foo', {:id => 'foo'}).should == %{<div id="foo" class="faux_legend">Foo</div>\r}
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'returns page break code' do
|
53
|
-
page_break.should == %{<div class="page_break" /><p>(Continued on next page)</p></div>}
|
54
|
-
end
|
55
|
-
|
56
|
-
|
44
|
+
|
57
45
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
-
require 'mitamirri'
|
3
2
|
|
4
|
-
describe
|
3
|
+
describe ContentReport do
|
5
4
|
|
6
5
|
before :all do
|
7
6
|
@args = {
|
@@ -10,16 +9,21 @@ describe "ContentReport" do
|
|
10
9
|
:visit_kind => 'search'
|
11
10
|
}
|
12
11
|
TrackableSession.stubs(:search).returns([])
|
13
|
-
@report =
|
14
|
-
|
12
|
+
@report = ContentReport.new(@args)
|
13
|
+
|
15
14
|
end
|
16
|
-
|
15
|
+
|
17
16
|
it 'initializes with arguments' do
|
18
17
|
@report.site.should == @args[:site]
|
19
18
|
@report.time_period.should == @args[:time_period]
|
20
19
|
@report.visit_kind.should == @args[:visit_kind]
|
21
20
|
end
|
22
21
|
|
22
|
+
it 'requires a site, time period, and visit kind' do
|
23
|
+
@report.ready?.should be_true
|
24
|
+
ContentReport.new({}).ready?.should be_false
|
25
|
+
end
|
26
|
+
|
23
27
|
it 'calculates its dates' do
|
24
28
|
@report.dates.should == [
|
25
29
|
(Time.zone.now - 2.months).beginning_of_month,
|
@@ -27,11 +31,11 @@ describe "ContentReport" do
|
|
27
31
|
(Time.zone.now).end_of_month,
|
28
32
|
]
|
29
33
|
end
|
30
|
-
|
34
|
+
|
31
35
|
it 'creates a ContentStat object from arguments' do
|
32
|
-
_stat =
|
36
|
+
_stat = ContentStat.new(:url => '/', :views => 3)
|
33
37
|
_stat.views.should == 3
|
34
38
|
_stat.url.should == '/'
|
35
39
|
end
|
36
|
-
|
40
|
+
|
37
41
|
end
|
@@ -10,7 +10,7 @@ describe "IntersiteTrafficReport" do
|
|
10
10
|
:visit_kind => 'search'
|
11
11
|
}
|
12
12
|
TrackableSession.stubs(:search).returns([])
|
13
|
-
@report =
|
13
|
+
@report = IntersiteTrafficReport.new(@args)
|
14
14
|
|
15
15
|
end
|
16
16
|
|
@@ -22,28 +22,25 @@ describe "IntersiteTrafficReport" do
|
|
22
22
|
|
23
23
|
it 'calculates its dates' do
|
24
24
|
@report.dates.should == [
|
25
|
-
(Time.zone.now -
|
26
|
-
(Time.zone.now
|
27
|
-
(Time.zone.now - 2.weeks).end_of_week,
|
28
|
-
(Time.zone.now - 1.weeks).end_of_week,
|
29
|
-
(Time.zone.now).end_of_week,
|
25
|
+
(Time.zone.now - 1.month).beginning_of_month,
|
26
|
+
(Time.zone.now).end_of_month,
|
30
27
|
]
|
31
28
|
end
|
32
29
|
|
33
30
|
it 'creates a Destination object from arguments' do
|
34
|
-
_stat =
|
31
|
+
_stat = Destination.new(:site => 'www.foo.com', :clickthroughs => 3)
|
35
32
|
_stat.clickthroughs.should == 3
|
36
33
|
_stat.site.should == 'www.foo.com'
|
37
34
|
end
|
38
35
|
|
39
36
|
it 'creates a Visit object from arguments' do
|
40
|
-
_stat =
|
37
|
+
_stat = Visit.new(:site => 'www.foo.com', :stats => [])
|
41
38
|
_stat.site.should == 'www.foo.com'
|
42
39
|
_stat.stats.should == []
|
43
40
|
end
|
44
41
|
|
45
42
|
it 'creates a VisitStat object from arguments' do
|
46
|
-
_stat =
|
43
|
+
_stat = VisitStat.new(:date => Time.zone.now.beginning_of_month, :clickthroughs => 3)
|
47
44
|
_stat.clickthroughs.should == 3
|
48
45
|
_stat.date.should == Time.zone.now.beginning_of_month
|
49
46
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
-
require 'mitamirri'
|
3
2
|
|
4
3
|
describe "LeadsReport" do
|
5
4
|
|
@@ -9,34 +8,34 @@ describe "LeadsReport" do
|
|
9
8
|
:time_period => 'past month',
|
10
9
|
}
|
11
10
|
TrackableSession.stubs(:search).returns([])
|
12
|
-
@report =
|
11
|
+
@report = LeadsReport.new(@args)
|
13
12
|
|
14
13
|
end
|
15
14
|
|
16
15
|
it 'initializes with arguments' do
|
17
16
|
@report.site.should == @args[:site]
|
18
17
|
@report.time_period.should == @args[:time_period]
|
19
|
-
@report.start_date.should == (Time.zone.now -
|
20
|
-
@report.end_date.to_s(:concise).should == Time.zone.now.to_s(:concise)
|
18
|
+
@report.start_date.should == (Time.zone.now - 1.month).beginning_of_month
|
19
|
+
@report.end_date.to_s(:concise).should == Time.zone.now.end_of_month.to_s(:concise)
|
21
20
|
end
|
22
21
|
|
23
22
|
it 'calculates its dates' do
|
24
|
-
@report.
|
25
|
-
(Time.zone.now - 4.weeks).
|
26
|
-
(Time.zone.now - 3.weeks).
|
27
|
-
(Time.zone.now - 2.weeks).
|
28
|
-
(Time.zone.now - 1.weeks).
|
29
|
-
Time.zone.now.to_s(:concise),
|
23
|
+
@report.dates_by_week.map{|d| d.to_s(:concise)}.should == [
|
24
|
+
(Time.zone.now - 4.weeks).end_of_week.to_s(:concise),
|
25
|
+
(Time.zone.now - 3.weeks).end_of_week.to_s(:concise),
|
26
|
+
(Time.zone.now - 2.weeks).end_of_week.to_s(:concise),
|
27
|
+
(Time.zone.now - 1.weeks).end_of_week.to_s(:concise),
|
28
|
+
Time.zone.now.end_of_week.to_s(:concise),
|
30
29
|
]
|
31
30
|
end
|
32
31
|
|
33
32
|
it 'creates a Lead object from arguments' do
|
34
|
-
_lead =
|
33
|
+
_lead = Lead.new(:stats => ['foo'])
|
35
34
|
_lead.stats.should == ['foo']
|
36
35
|
end
|
37
36
|
|
38
37
|
it 'creates a LeadStats object from arguments' do
|
39
|
-
_stat =
|
38
|
+
_stat = LeadStat.new(:date => Time.zone.now.end_of_week, :leads => 3, :conversion_rate => 50.0)
|
40
39
|
_stat.date.should == Time.zone.now.end_of_week
|
41
40
|
_stat.leads.should == 3
|
42
41
|
_stat.conversion_rate.should == 50.0
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe "LocationStat" do
|
4
|
+
|
5
|
+
before :all do
|
6
|
+
LocationStat.any_instance.stubs(:geocode).returns(false)
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'determines if it has been geocoded' do
|
10
|
+
LocationStat.new({}).geocoded?.should be_false
|
11
|
+
LocationStat.new(:latitude => 90.0, :longitude => 90.0).geocoded?.should be_true
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'removes apostrophes from its name' do
|
15
|
+
LocationStat.new(:name => "Grover's Corners").sanitized_name.should == "Grover\\'s Corners"
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -1,14 +1,34 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
-
require 'mitamirri'
|
3
2
|
|
4
|
-
describe
|
5
|
-
|
3
|
+
describe TrackableAction do
|
4
|
+
|
5
|
+
it 'returns a list of tracked actions' do
|
6
|
+
TrackableAction.delete_all
|
7
|
+
TrackableAction.create(:kind => 'clicks')
|
8
|
+
TrackableAction.create(:kind => 'conversion')
|
9
|
+
TrackableAction.kinds.include?('clicks').should be_true
|
10
|
+
TrackableAction.kinds.include?('conversion').should be_true
|
11
|
+
TrackableAction.kinds.should have(2).items
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'returns a histogram of pages' do
|
15
|
+
TrackableAction.delete_all
|
16
|
+
ts = TrackableSession.make(:views_count => 3)
|
17
|
+
ts.trackable_actions.create!(:kind => 'view', :url => 'http://www.seologic.com/foo')
|
18
|
+
ts.trackable_actions.create!(:kind => 'view', :url => 'http://www.seologic.com/bar')
|
19
|
+
ts.trackable_actions.create!(:kind => 'view', :url => 'http://www.seologic.com/bar')
|
20
|
+
h = TrackableAction.pages_histogram({})
|
21
|
+
hash = Hash[*h.flatten]
|
22
|
+
hash['/foo'].should == 1.0
|
23
|
+
hash['/bar'].should == 2.0
|
24
|
+
end
|
25
|
+
|
6
26
|
describe 'creates a new object from parameters' do
|
7
|
-
|
27
|
+
|
8
28
|
before :all do
|
9
29
|
@new = TrackableAction.create_from_params(
|
10
30
|
:session_id => 123456,
|
11
|
-
:referrer => '/',
|
31
|
+
:referrer => 'http://www.cnn.com/',
|
12
32
|
:ip_address => '123.123.123.1',
|
13
33
|
:site => 'www.seologic.com',
|
14
34
|
:kind => 'click',
|
@@ -16,27 +36,39 @@ describe "TrackableAction" do
|
|
16
36
|
:url => 'http://www.seologic.com/foo/bar/'
|
17
37
|
)
|
18
38
|
end
|
19
|
-
|
39
|
+
|
20
40
|
it 'with a kind' do
|
21
41
|
@new.kind.should == 'click'
|
22
42
|
end
|
23
|
-
|
24
|
-
it 'with a label' do
|
43
|
+
|
44
|
+
it 'with a label' do
|
25
45
|
@new.label.should == 'Some Random Click'
|
26
46
|
end
|
27
|
-
|
47
|
+
|
28
48
|
it 'with a referrer' do
|
29
|
-
@new.referrer.should == '/'
|
49
|
+
@new.referrer.should == 'http://www.cnn.com/'
|
30
50
|
end
|
31
|
-
|
51
|
+
|
32
52
|
it 'with a URL' do
|
33
53
|
@new.url.should == 'http://www.seologic.com/foo/bar/'
|
34
54
|
end
|
35
|
-
|
55
|
+
|
36
56
|
it 'with an associated trackable session' do
|
37
57
|
@new.trackable_session_id.should_not be_nil
|
38
58
|
end
|
39
|
-
|
59
|
+
|
60
|
+
it 'rejects an unparsable referrer URL' do
|
61
|
+
TrackableAction.create_from_params(
|
62
|
+
:session_id => 123456,
|
63
|
+
:referrer => '/foo/bar',
|
64
|
+
:ip_address => '123.123.123.1',
|
65
|
+
:site => 'www.seologic.com',
|
66
|
+
:kind => 'click',
|
67
|
+
:label => 'Some Random Click',
|
68
|
+
:url => 'http://www.seologic.com/foo/bar/'
|
69
|
+
).referrer.should == '/foo/bar'
|
70
|
+
end
|
71
|
+
|
40
72
|
end
|
41
|
-
|
73
|
+
|
42
74
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe TrackableBase do
|
4
|
+
|
5
|
+
describe 'extracts start and end dates from a provided range' do
|
6
|
+
|
7
|
+
it 'that encompasses the past 3 months' do
|
8
|
+
start_date, end_date = TrackableBase.dates_from_time_period('past 3 months')
|
9
|
+
start_date.should == (Time.zone.now - 2.months).beginning_of_month
|
10
|
+
end_date.should == Time.zone.now.end_of_month
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'that encompasses the past 6 months' do
|
14
|
+
start_date, end_date = TrackableBase.dates_from_time_period('past 6 months')
|
15
|
+
start_date.should == (Time.zone.now - 5.months).beginning_of_month
|
16
|
+
end_date.should == Time.zone.now.end_of_month
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'that encompasses the past 12 months' do
|
20
|
+
start_date, end_date = TrackableBase.dates_from_time_period('past 12 months')
|
21
|
+
start_date.should == (Time.zone.now - 11.months).beginning_of_month
|
22
|
+
end_date.should == Time.zone.now.end_of_month
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -3,152 +3,276 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|
3
3
|
describe "TrackableSession" do
|
4
4
|
|
5
5
|
describe 'class methods' do
|
6
|
-
|
6
|
+
|
7
7
|
it 'calculates conversion rates' do
|
8
|
-
TrackableSession.stubs(:search).returns(TrackableSession.new)
|
9
|
-
TrackableSession.any_instance.stubs(:with_conversions).returns(TrackableSession.new(:has_conversions => true))
|
8
|
+
TrackableSession.stubs(:search).returns(TrackableSession.new(:ip_address => '192.1.1.5'))
|
9
|
+
TrackableSession.any_instance.stubs(:with_conversions).returns(TrackableSession.new(:ip_address => '192.1.1.5', :has_conversions => true))
|
10
10
|
TrackableSession.any_instance.stubs(:count).returns(1)
|
11
|
-
|
11
|
+
|
12
12
|
TrackableSession.conversion_rate({}).should == 100
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
it 'returns kinds suitably formatted for a select' do
|
16
16
|
TrackableSession.kinds_for_select.should == [["All", "all"], ["Direct", "direct"], ["Natural", "natural"], ["Paid", "paid"], ["Search", "search"]]
|
17
|
-
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
describe 'histograms' do
|
23
|
+
|
24
|
+
it 'generates a histogram of clickthroughs' do
|
25
|
+
TrackableSession.destroy_all
|
26
|
+
TrackableSession.make(:clickthrough_destination => 'seologic.com')
|
27
|
+
TrackableSession.make(:clickthrough_destination => 'seologic.com')
|
28
|
+
TrackableSession.make(:clickthrough_destination => 'internetmadeeasy.com')
|
29
|
+
h = TrackableSession.clickthroughs_histogram({:time_period => 'past 3 months', :site => 'all sites'})
|
30
|
+
h['seologic.com'].should == 2.0
|
31
|
+
h['internetmadeeasy.com'].should == 1.0
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'generates a histogram of entrance pages' do
|
35
|
+
TrackableSession.destroy_all
|
36
|
+
TrackableSession.make(:entrance_page => '/')
|
37
|
+
TrackableSession.make(:entrance_page => '/')
|
38
|
+
TrackableSession.make(:entrance_page => '/index.htm')
|
39
|
+
h = TrackableSession.entrance_pages_histogram({:time_period => 'past 3 months', :site => 'all sites'})
|
40
|
+
hash = Hash[*h.flatten]
|
41
|
+
hash['/'].should == 2.0
|
42
|
+
hash['/index.htm'].should == 1.0
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'generates a histogram of exit pages' do
|
46
|
+
TrackableSession.destroy_all
|
47
|
+
TrackableSession.make(:exit_page => '/')
|
48
|
+
TrackableSession.make(:exit_page => '/')
|
49
|
+
TrackableSession.make(:exit_page => '/index.htm')
|
50
|
+
h = TrackableSession.exit_pages_histogram({:time_period => 'past 3 months', :site => 'all sites'})
|
51
|
+
hash = Hash[*h.flatten]
|
52
|
+
hash['/'].should == 2.0
|
53
|
+
hash['/index.htm'].should == 1.0
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'generates a histogram of keywords' do
|
57
|
+
TrackableSession.destroy_all
|
58
|
+
TrackableSession.make(:referring_keywords => 'foo bar')
|
59
|
+
TrackableSession.make(:referring_keywords => 'foo bar')
|
60
|
+
TrackableSession.make(:referring_keywords => 'bat')
|
61
|
+
h = TrackableSession.keywords_histogram({:time_period => 'past 3 months', :site => 'all sites'})
|
62
|
+
h['foo bar'].should == 2.0
|
63
|
+
h['bat'].should == 1.0
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'generates a histogram of locations' do
|
67
|
+
TrackableSession.destroy_all
|
68
|
+
TrackableSession.make(:location => 'Claremont, VA')
|
69
|
+
TrackableSession.make(:location => 'Claremont, VA')
|
70
|
+
TrackableSession.make(:location => 'Richmond, VA')
|
71
|
+
h = TrackableSession.locations_histogram({:time_period => 'past 3 months', :site => 'all sites'})
|
72
|
+
h['Claremont, VA'].should == 2.0
|
73
|
+
h['Richmond, VA'].should == 1.0
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'generates a histogram of referrers' do
|
77
|
+
TrackableSession.destroy_all
|
78
|
+
TrackableSession.make(:referrer => 'http://www.google.com/')
|
79
|
+
TrackableSession.make(:referrer => 'http://www.google.com/')
|
80
|
+
TrackableSession.make(:referrer => 'http://www.bing.com/')
|
81
|
+
h = TrackableSession.referrers_histogram({:time_period => 'past 3 months', :site => 'all sites'})
|
82
|
+
h['http://www.google.com/'].should == 2.0
|
83
|
+
h['http://www.bing.com/'].should == 1.0
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'generates a histogram of user agents' do
|
87
|
+
TrackableSession.destroy_all
|
88
|
+
TrackableSession.make(:user_agent => 'Firefox 2.0 (Mac OS X)')
|
89
|
+
TrackableSession.make(:user_agent => 'Firefox 2.0 (Mac OS X)')
|
90
|
+
TrackableSession.make(:user_agent => 'Firefox 1.0 (Mac OS X)')
|
91
|
+
h = TrackableSession.user_agents_histogram({:time_period => 'past 3 months', :site => 'all sites'})
|
92
|
+
h['Firefox 2.0 (Unknown)'].should == 2.0
|
93
|
+
h['Firefox 1.0 (Unknown)'].should == 1.0
|
18
94
|
end
|
19
|
-
|
95
|
+
|
20
96
|
end
|
21
97
|
|
22
98
|
describe 'instance methods' do
|
23
|
-
|
99
|
+
|
100
|
+
before :all do
|
101
|
+
TrackableSession.destroy_all
|
102
|
+
end
|
103
|
+
|
24
104
|
describe 'initializes' do
|
25
|
-
|
105
|
+
|
26
106
|
it 'defaulting its new_visit flag to true' do
|
27
|
-
TrackableSession.stubs(:
|
107
|
+
TrackableSession.stubs(:where).returns(nil)
|
28
108
|
_new_session = TrackableSession.new(:ip_address => '192.1.1.5')
|
29
109
|
_new_session.init
|
30
110
|
_new_session.new_visit.should be_true
|
31
111
|
end
|
32
|
-
|
112
|
+
|
33
113
|
it 'detecting a return visit' do
|
34
|
-
TrackableSession.stubs(:
|
114
|
+
TrackableSession.stubs(:where).returns(['a record'])
|
35
115
|
_new_session = TrackableSession.new(:ip_address => '192.1.1.5')
|
36
116
|
_new_session.init
|
37
117
|
_new_session.new_visit.should be_false
|
38
118
|
end
|
39
|
-
|
119
|
+
|
40
120
|
it 'detecting a visit from a spider' do
|
41
121
|
# Human user agents
|
42
122
|
[
|
43
|
-
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0",
|
123
|
+
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0",
|
44
124
|
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)",
|
45
125
|
"Opera/9.20 (Windows NT 6.0; U; en)",
|
46
126
|
"Macintosh; U; Intel Mac OS X 10_6_4; en-us) AppleWebKit/533.17.8 (KHTML, like Gecko) Version/5.0.1 Safari/533.17.8"
|
47
|
-
].each do |ua|
|
48
|
-
_session = TrackableSession.new(:user_agent => ua)
|
127
|
+
].each do |ua|
|
128
|
+
_session = TrackableSession.new(:ip_address => '192.1.1.5', :user_agent => ua)
|
49
129
|
_session.init
|
50
130
|
_session.spider?.should be_false
|
51
131
|
end
|
52
132
|
# Bots
|
53
133
|
[
|
54
|
-
"Googlebot/2.1 ( http://www.googlebot.com/bot.html) ",
|
55
|
-
"msnbot-Products/1.0 (+http://search.msn.com/msnbot.htm)",
|
56
|
-
].each do |ua|
|
57
|
-
_session = TrackableSession.new(:user_agent => ua)
|
134
|
+
"Googlebot/2.1 ( http://www.googlebot.com/bot.html) ",
|
135
|
+
"msnbot-Products/1.0 (+http://search.msn.com/msnbot.htm)",
|
136
|
+
].each do |ua|
|
137
|
+
_session = TrackableSession.new(:ip_address => '192.1.1.5', :user_agent => ua)
|
58
138
|
_session.init
|
59
139
|
_session.spider?.should be_true
|
60
140
|
end
|
61
141
|
end
|
62
|
-
|
142
|
+
|
63
143
|
it 'setting its kind' do
|
64
|
-
_new_session = TrackableSession.new
|
144
|
+
_new_session = TrackableSession.new(:ip_address => '192.1.1.5')
|
65
145
|
_new_session.init
|
66
146
|
_new_session.kind.should_not be_nil
|
67
147
|
end
|
68
|
-
|
148
|
+
|
69
149
|
end
|
70
|
-
|
150
|
+
|
71
151
|
it 'calculates its duration in seconds' do
|
72
|
-
TrackableSession.new(:duration => 30).hr_duration.should == '30.0 seconds'
|
152
|
+
TrackableSession.new(:ip_address => '192.1.1.5', :duration => 30).hr_duration.should == '30.0 seconds'
|
73
153
|
end
|
74
|
-
|
154
|
+
|
75
155
|
it 'calculates its duration in minutes' do
|
76
|
-
TrackableSession.new(:duration => 90).hr_duration.should == '1.5 minutes'
|
156
|
+
TrackableSession.new(:ip_address => '192.1.1.5', :duration => 90).hr_duration.should == '1.5 minutes'
|
77
157
|
end
|
78
|
-
|
158
|
+
|
79
159
|
it 'it sanitizes referring keywords' do
|
80
|
-
_session = TrackableSession.new(:referring_keywords => 'some+keywords+here')
|
160
|
+
_session = TrackableSession.new(:ip_address => '192.1.1.5', :referring_keywords => 'some+keywords+here')
|
81
161
|
_session.sanitize_referring_keywords.should == 'some keywords here'
|
82
162
|
end
|
83
|
-
|
163
|
+
|
84
164
|
it 'returns the date of the last previous visit' do
|
85
|
-
_first = TrackableSession.create(:ip_address => '
|
86
|
-
_second = TrackableSession.create(:ip_address => '
|
87
|
-
_third = TrackableSession.create(:ip_address => '
|
88
|
-
_third.last_visit_date.should == _second.created_at.to_s(:concise)
|
165
|
+
_first = TrackableSession.create(:ip_address => '72.32.210.44', :created_at => Time.zone.now - 2.months)
|
166
|
+
_second = TrackableSession.create(:ip_address => '72.32.210.44', :created_at => Time.zone.now - 1.months)
|
167
|
+
_third = TrackableSession.create(:ip_address => '72.32.210.44', :created_at => Time.zone.now)
|
168
|
+
_third.last_visit_date.to_s(:concise).should == _second.created_at.to_s(:concise)
|
89
169
|
end
|
90
|
-
|
170
|
+
|
91
171
|
it 'updates its timestamp' do
|
92
172
|
_then = Time.zone.now - 30.seconds
|
93
|
-
_session = TrackableSession.new(:created_at => _then)
|
173
|
+
_session = TrackableSession.new(:ip_address => '192.1.1.5', :created_at => _then)
|
94
174
|
_session.stubs(:save).returns(true)
|
95
175
|
_session.stubs(:touch_stat).returns(true)
|
96
176
|
sleep(1)
|
97
177
|
_session.touch
|
98
178
|
(_session.updated_at > _then).should be_true
|
99
179
|
end
|
100
|
-
|
180
|
+
|
101
181
|
it "returns visit_type of 'New' if it's a new visit" do
|
102
|
-
TrackableSession.new(:new_visit => true).visit_type.should == 'New'
|
182
|
+
TrackableSession.new(:ip_address => '192.1.1.5', :new_visit => true).visit_type.should == 'New'
|
103
183
|
end
|
104
|
-
|
184
|
+
|
105
185
|
it "returns visit_type of 'Returning' if it's not a new visit" do
|
106
|
-
TrackableSession.new(:new_visit => nil).visit_type.should == 'Returning'
|
186
|
+
TrackableSession.new(:ip_address => '192.1.1.5', :new_visit => nil).visit_type.should == 'Returning'
|
107
187
|
end
|
108
|
-
|
188
|
+
|
109
189
|
describe 'sets its kind by referrer' do
|
110
|
-
|
190
|
+
|
111
191
|
it 'with a search engine referrer' do
|
112
|
-
TrackableSession.new(:referrer => 'http://www.google.com/search/').kind_by_referrer.should == 'search'
|
192
|
+
TrackableSession.new(:ip_address => '192.1.1.5', :referrer => 'http://www.google.com/search/').kind_by_referrer.should == 'search'
|
113
193
|
end
|
114
|
-
|
194
|
+
|
115
195
|
it 'with an organic referrer' do
|
116
|
-
TrackableSession.new(:referrer => 'http://www.seologic.com/foo.htm').kind_by_referrer.should == 'natural'
|
196
|
+
TrackableSession.new(:ip_address => '192.1.1.5', :referrer => 'http://www.seologic.com/foo.htm').kind_by_referrer.should == 'natural'
|
117
197
|
end
|
118
|
-
|
198
|
+
|
119
199
|
it 'with a PPC referrer' do
|
120
200
|
TrackableSession.new(
|
121
|
-
:
|
201
|
+
:ip_address => '192.1.1.5',
|
202
|
+
:initial_request_url => 'http://www.seologic.com/foo.htm?gclid=1234',
|
122
203
|
:referrer => 'http://www.foo.com/'
|
123
204
|
).kind_by_referrer.should == 'paid'
|
124
205
|
TrackableSession.new(
|
125
|
-
:
|
206
|
+
:ip_address => '192.1.1.5',
|
207
|
+
:initial_request_url => 'http://www.seologic.com/foo.htm?keyword=1234',
|
126
208
|
:referrer => 'http://www.foo.com/'
|
127
209
|
).kind_by_referrer.should == 'paid'
|
128
210
|
TrackableSession.new(
|
129
|
-
:
|
211
|
+
:ip_address => '192.1.1.5',
|
212
|
+
:initial_request_url => 'http://www.seologic.com/foo.htm?adid=1234',
|
130
213
|
:referrer => 'http://www.foo.com/'
|
131
214
|
).kind_by_referrer.should == 'paid'
|
132
215
|
TrackableSession.new(
|
133
|
-
:
|
216
|
+
:ip_address => '192.1.1.5',
|
217
|
+
:initial_request_url => 'http://www.seologic.com/foo.htm?matchtype=1234',
|
134
218
|
:referrer => 'http://www.foo.com/'
|
135
219
|
).kind_by_referrer.should == 'paid'
|
136
220
|
TrackableSession.new(
|
137
|
-
:
|
221
|
+
:ip_address => '192.1.1.5',
|
222
|
+
:initial_request_url => 'http://www.seologic.com/foo.htm?ppc=1234',
|
138
223
|
:referrer => 'http://www.foo.com/'
|
139
224
|
).kind_by_referrer.should == 'paid'
|
140
225
|
TrackableSession.new(
|
141
|
-
:
|
226
|
+
:ip_address => '192.1.1.5',
|
227
|
+
:initial_request_url => 'http://www.seologic.com/foo.htm?cpc=1234',
|
142
228
|
:referrer => 'http://www.foo.com/'
|
143
229
|
).kind_by_referrer.should == 'paid'
|
144
230
|
end
|
145
|
-
|
231
|
+
|
146
232
|
it 'with no referrer' do
|
147
|
-
TrackableSession.new(:referrer => nil).kind_by_referrer.should == 'direct'
|
233
|
+
TrackableSession.new(:ip_address => '192.1.1.5', :referrer => nil).kind_by_referrer.should == 'direct'
|
148
234
|
end
|
149
|
-
|
235
|
+
|
150
236
|
end
|
151
|
-
|
237
|
+
|
238
|
+
describe 'updates its stats' do
|
239
|
+
|
240
|
+
before :all do
|
241
|
+
@session = TrackableSession.make
|
242
|
+
@session.touch('scroll', '/foo', '/')
|
243
|
+
@session = TrackableSession.last
|
244
|
+
@session.touch('click', '/foo', '/')
|
245
|
+
@session.touch('clickthrough', '/foo', '/')
|
246
|
+
@session.touch('mouseover', '/foo', '/')
|
247
|
+
@session.touch('conversion', '/foo', '/')
|
248
|
+
end
|
249
|
+
|
250
|
+
it 'with a scroll action' do
|
251
|
+
@session.has_scrolls.should be_true
|
252
|
+
end
|
253
|
+
|
254
|
+
it 'with a click action' do
|
255
|
+
@session.has_clicks.should be_true
|
256
|
+
end
|
257
|
+
|
258
|
+
it 'with a clickthrough action' do
|
259
|
+
@session.has_clickthroughs.should be_true
|
260
|
+
end
|
261
|
+
|
262
|
+
it 'with a mouseover action' do
|
263
|
+
@session.has_mouseovers.should be_true
|
264
|
+
end
|
265
|
+
|
266
|
+
it 'with a conversion action' do
|
267
|
+
@session.has_conversions.should be_true
|
268
|
+
end
|
269
|
+
|
270
|
+
it 'sets its duration' do
|
271
|
+
@session.duration.class.should == Float
|
272
|
+
end
|
273
|
+
|
274
|
+
end
|
275
|
+
|
152
276
|
end
|
153
|
-
|
277
|
+
|
154
278
|
end
|