analytical 2.11.0 → 3.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.rspec +2 -0
- data/.rvmrc +8 -0
- data/Gemfile +10 -4
- data/Gemfile.lock +86 -24
- data/README.rdoc +42 -7
- data/Rakefile +4 -12
- data/VERSION +1 -1
- data/analytical.gemspec +34 -11
- data/app/views/application/_analytical_javascript.html.erb +11 -0
- data/lib/analytical.rb +35 -24
- data/lib/analytical/api.rb +17 -3
- data/lib/analytical/modules/clicky.rb +12 -3
- data/lib/analytical/modules/console.rb +1 -1
- data/lib/analytical/modules/google.rb +3 -2
- data/lib/analytical/modules/reinvigorate.rb +48 -0
- data/lib/analytical/rails/engine.rb +9 -0
- data/spec/analytical/api_spec.rb +5 -5
- data/spec/analytical/modules/google_spec.rb +11 -2
- data/spec/analytical/modules/reinvigorate_spec.rb +35 -0
- data/spec/analytical_spec.rb +43 -14
- data/spec/config/analytical.yml +15 -9
- data/spec/spec_helper.rb +15 -12
- metadata +142 -41
data/.rspec
ADDED
data/.rvmrc
ADDED
data/Gemfile
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
source :rubygems
|
|
2
2
|
|
|
3
|
-
group :development do
|
|
3
|
+
group :development, :test do
|
|
4
|
+
gem 'rails', '3.0.9'
|
|
5
|
+
gem 'activesupport'
|
|
6
|
+
gem 'activemodel'
|
|
7
|
+
gem 'rspec', '2.6.0'
|
|
8
|
+
gem 'rspec-core', '2.6.4'
|
|
9
|
+
gem 'rspec-expectations', '2.6.0'
|
|
10
|
+
gem 'rspec-mocks', '2.6.0'
|
|
11
|
+
gem 'rspec-rails', '2.6.0'
|
|
4
12
|
gem 'jeweler'
|
|
5
|
-
gem 'rspec', '1.3'
|
|
6
13
|
gem 'diff-lcs'
|
|
7
|
-
gem 'rails', '~> 2.3'
|
|
8
14
|
gem 'guard'
|
|
9
15
|
gem 'guard-rspec'
|
|
10
16
|
gem 'rb-fsevent'
|
|
11
17
|
gem 'growl'
|
|
12
|
-
end
|
|
18
|
+
end
|
data/Gemfile.lock
CHANGED
|
@@ -1,18 +1,39 @@
|
|
|
1
1
|
GEM
|
|
2
2
|
remote: http://rubygems.org/
|
|
3
3
|
specs:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
activesupport (=
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
abstract (1.0.0)
|
|
5
|
+
actionmailer (3.0.9)
|
|
6
|
+
actionpack (= 3.0.9)
|
|
7
|
+
mail (~> 2.2.19)
|
|
8
|
+
actionpack (3.0.9)
|
|
9
|
+
activemodel (= 3.0.9)
|
|
10
|
+
activesupport (= 3.0.9)
|
|
11
|
+
builder (~> 2.1.2)
|
|
12
|
+
erubis (~> 2.6.6)
|
|
13
|
+
i18n (~> 0.5.0)
|
|
14
|
+
rack (~> 1.2.1)
|
|
15
|
+
rack-mount (~> 0.6.14)
|
|
16
|
+
rack-test (~> 0.5.7)
|
|
17
|
+
tzinfo (~> 0.3.23)
|
|
18
|
+
activemodel (3.0.9)
|
|
19
|
+
activesupport (= 3.0.9)
|
|
20
|
+
builder (~> 2.1.2)
|
|
21
|
+
i18n (~> 0.5.0)
|
|
22
|
+
activerecord (3.0.9)
|
|
23
|
+
activemodel (= 3.0.9)
|
|
24
|
+
activesupport (= 3.0.9)
|
|
25
|
+
arel (~> 2.0.10)
|
|
26
|
+
tzinfo (~> 0.3.23)
|
|
27
|
+
activeresource (3.0.9)
|
|
28
|
+
activemodel (= 3.0.9)
|
|
29
|
+
activesupport (= 3.0.9)
|
|
30
|
+
activesupport (3.0.9)
|
|
31
|
+
arel (2.0.10)
|
|
32
|
+
builder (2.1.2)
|
|
14
33
|
configuration (1.2.0)
|
|
15
34
|
diff-lcs (1.1.2)
|
|
35
|
+
erubis (2.6.6)
|
|
36
|
+
abstract (>= 1.0.0)
|
|
16
37
|
git (1.2.5)
|
|
17
38
|
growl (1.0.3)
|
|
18
39
|
guard (0.3.0)
|
|
@@ -20,37 +41,78 @@ GEM
|
|
|
20
41
|
thor (~> 0.14.6)
|
|
21
42
|
guard-rspec (0.2.0)
|
|
22
43
|
guard (>= 0.2.2)
|
|
23
|
-
|
|
24
|
-
|
|
44
|
+
i18n (0.5.0)
|
|
45
|
+
jeweler (1.6.4)
|
|
46
|
+
bundler (~> 1.0)
|
|
25
47
|
git (>= 1.2.5)
|
|
26
48
|
rake
|
|
27
49
|
launchy (0.3.7)
|
|
28
50
|
configuration (>= 0.0.5)
|
|
29
51
|
rake (>= 0.8.1)
|
|
52
|
+
mail (2.2.19)
|
|
53
|
+
activesupport (>= 2.3.6)
|
|
54
|
+
i18n (>= 0.4.0)
|
|
55
|
+
mime-types (~> 1.16)
|
|
56
|
+
treetop (~> 1.4.8)
|
|
57
|
+
mime-types (1.16)
|
|
30
58
|
open_gem (1.4.2)
|
|
31
59
|
launchy (~> 0.3.5)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
60
|
+
polyglot (0.3.1)
|
|
61
|
+
rack (1.2.3)
|
|
62
|
+
rack-mount (0.6.14)
|
|
63
|
+
rack (>= 1.0.0)
|
|
64
|
+
rack-test (0.5.7)
|
|
65
|
+
rack (>= 1.0)
|
|
66
|
+
rails (3.0.9)
|
|
67
|
+
actionmailer (= 3.0.9)
|
|
68
|
+
actionpack (= 3.0.9)
|
|
69
|
+
activerecord (= 3.0.9)
|
|
70
|
+
activeresource (= 3.0.9)
|
|
71
|
+
activesupport (= 3.0.9)
|
|
72
|
+
bundler (~> 1.0)
|
|
73
|
+
railties (= 3.0.9)
|
|
74
|
+
railties (3.0.9)
|
|
75
|
+
actionpack (= 3.0.9)
|
|
76
|
+
activesupport (= 3.0.9)
|
|
77
|
+
rake (>= 0.8.7)
|
|
78
|
+
rdoc (~> 3.4)
|
|
79
|
+
thor (~> 0.14.4)
|
|
80
|
+
rake (0.9.2)
|
|
41
81
|
rb-fsevent (0.4.0)
|
|
42
|
-
|
|
82
|
+
rdoc (3.6.1)
|
|
83
|
+
rspec (2.6.0)
|
|
84
|
+
rspec-core (~> 2.6.0)
|
|
85
|
+
rspec-expectations (~> 2.6.0)
|
|
86
|
+
rspec-mocks (~> 2.6.0)
|
|
87
|
+
rspec-core (2.6.4)
|
|
88
|
+
rspec-expectations (2.6.0)
|
|
89
|
+
diff-lcs (~> 1.1.2)
|
|
90
|
+
rspec-mocks (2.6.0)
|
|
91
|
+
rspec-rails (2.6.0)
|
|
92
|
+
actionpack (~> 3.0)
|
|
93
|
+
activesupport (~> 3.0)
|
|
94
|
+
railties (~> 3.0)
|
|
95
|
+
rspec (~> 2.6.0)
|
|
43
96
|
thor (0.14.6)
|
|
97
|
+
treetop (1.4.9)
|
|
98
|
+
polyglot (>= 0.3.1)
|
|
99
|
+
tzinfo (0.3.28)
|
|
44
100
|
|
|
45
101
|
PLATFORMS
|
|
46
102
|
ruby
|
|
47
103
|
|
|
48
104
|
DEPENDENCIES
|
|
105
|
+
activemodel
|
|
106
|
+
activesupport
|
|
49
107
|
diff-lcs
|
|
50
108
|
growl
|
|
51
109
|
guard
|
|
52
110
|
guard-rspec
|
|
53
111
|
jeweler
|
|
54
|
-
rails (
|
|
112
|
+
rails (= 3.0.9)
|
|
55
113
|
rb-fsevent
|
|
56
|
-
rspec (=
|
|
114
|
+
rspec (= 2.6.0)
|
|
115
|
+
rspec-core (= 2.6.4)
|
|
116
|
+
rspec-expectations (= 2.6.0)
|
|
117
|
+
rspec-mocks (= 2.6.0)
|
|
118
|
+
rspec-rails (= 2.6.0)
|
data/README.rdoc
CHANGED
|
@@ -22,14 +22,21 @@ Service implementations include:
|
|
|
22
22
|
|
|
23
23
|
Add the following to your controllers:
|
|
24
24
|
|
|
25
|
-
analytical
|
|
25
|
+
analytical
|
|
26
26
|
|
|
27
27
|
Add a configuration file (config/analytical.yml) to declare your API keys, like so:
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
production:
|
|
30
|
+
google:
|
|
31
|
+
key: UA-5555555-5
|
|
32
|
+
clicky:
|
|
33
|
+
key: 55555
|
|
34
|
+
|
|
35
|
+
You can add different configurations for different environments.
|
|
36
|
+
|
|
37
|
+
By default, all the declared analytics modules are loaded. You can override this behavior in the controller.
|
|
38
|
+
|
|
39
|
+
analytical :modules=>[:console, :google, :clicky]
|
|
33
40
|
|
|
34
41
|
Then, in your template files, you'll want to add the analytical helper methods for initializing the tracking javascript:
|
|
35
42
|
|
|
@@ -60,9 +67,22 @@ You can sprinkle the track() and event() tracking methods throughout your views
|
|
|
60
67
|
analytical.track '/a/really/nice/url'
|
|
61
68
|
analytical.event 'Some Awesome Event', :with=>:data
|
|
62
69
|
|
|
63
|
-
|
|
70
|
+
It's possible to conditionally disable analytics by specifying a `disable_if` method.
|
|
71
|
+
|
|
72
|
+
analytical :disable_if => lambda{ |controller| controller.i_can_haz_tracking? }
|
|
73
|
+
|
|
74
|
+
Analytical also provides the ability to filter your active modules dynamically:
|
|
75
|
+
|
|
76
|
+
analytical :filter_modules => lambda{ |controller, modules|
|
|
77
|
+
controller.use_google_analytics? ? modules : modules - [:google]
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
This can be useful for enabling the console logger optionally in your app, based on a request parameter:
|
|
81
|
+
|
|
82
|
+
:filter_modules => lambda { |controller, modules|
|
|
83
|
+
controller.use_console_logger? ? [:console] : modules
|
|
84
|
+
}
|
|
64
85
|
|
|
65
|
-
analytical :modules=>[:google], :development_modules=>[], :disable_if=>lambda{ |controller| controller.i_can_haz_tracking? }
|
|
66
86
|
|
|
67
87
|
== Adding new modules
|
|
68
88
|
|
|
@@ -83,6 +103,21 @@ This will store the queued commands in the user session, clearing them out when
|
|
|
83
103
|
... in your controller. After a redirect, the corresponding track() call will be emitted in the next request made by the client.
|
|
84
104
|
NOTE: This is new and somewhat experimental, and could cause problems if you store large amounts of data in the session. (there is a 4k limit to session data)
|
|
85
105
|
|
|
106
|
+
== Javascript tracking/event commands
|
|
107
|
+
|
|
108
|
+
Sometimes you want to trigger an analytics track/event via javascript. Analytical now provides a solution for this by default. Appended to your <head> is a simple javascript object that will contain "instantaneous" versions of the tracking commands for each of your modules.
|
|
109
|
+
|
|
110
|
+
You call these analytical commands like this:
|
|
111
|
+
|
|
112
|
+
<script type="text/javascript">Analytical.track('/some/url');</script>
|
|
113
|
+
<script type="text/javascript">Analytical.event('A javascript event', {with: 'data'});</script>
|
|
114
|
+
|
|
115
|
+
When you call these commands, it will pass the track/event name & data on to each of the modules. (Take a look at the simple javascript helpers in your <head> for more information.)
|
|
116
|
+
|
|
117
|
+
To disable this functionality, use
|
|
118
|
+
|
|
119
|
+
analytical :javascript_helpers => false
|
|
120
|
+
|
|
86
121
|
|
|
87
122
|
== Note on Patches/Pull Requests
|
|
88
123
|
|
data/Rakefile
CHANGED
|
@@ -9,7 +9,7 @@ begin
|
|
|
9
9
|
gem.description = %Q{Gem for managing multiple analytics services in your rails app.}
|
|
10
10
|
gem.email = "josh@feefighters.com"
|
|
11
11
|
gem.homepage = "http://github.com/jkrall/analytical"
|
|
12
|
-
gem.authors = ["Joshua Krall", "Nathan Phelps", "Adam Anderson", "Kevin Menard", "Ablyamitov Ablyamit", "Kurt Werle", "Olivier Lauzon"]
|
|
12
|
+
gem.authors = ["Joshua Krall", "Nathan Phelps", "Adam Anderson", "Kevin Menard", "Ablyamitov Ablyamit", "Kurt Werle", "Olivier Lauzon", "Daniel Doubrovkine"]
|
|
13
13
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
|
14
14
|
end
|
|
15
15
|
Jeweler::GemcutterTasks.new
|
|
@@ -17,17 +17,9 @@ rescue LoadError
|
|
|
17
17
|
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
require '
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
|
27
|
-
spec.libs << 'lib' << 'spec'
|
|
28
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
|
29
|
-
spec.rcov = true
|
|
30
|
-
end
|
|
20
|
+
require 'rspec/core/rake_task'
|
|
21
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
22
|
+
RSpec::Core::RakeTask.new(:rcov)
|
|
31
23
|
|
|
32
24
|
task :default => :spec
|
|
33
25
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
3.0.6
|
data/analytical.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{analytical}
|
|
8
|
-
s.version = "
|
|
8
|
+
s.version = "3.0.6"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
|
-
s.authors = ["Joshua Krall", "Nathan Phelps", "Adam Anderson", "Kevin Menard", "Ablyamitov Ablyamit", "Kurt Werle", "Olivier Lauzon"]
|
|
12
|
-
s.date = %q{2011-
|
|
11
|
+
s.authors = ["Joshua Krall", "Nathan Phelps", "Adam Anderson", "Kevin Menard", "Ablyamitov Ablyamit", "Kurt Werle", "Olivier Lauzon", "Daniel Doubrovkine"]
|
|
12
|
+
s.date = %q{2011-08-08}
|
|
13
13
|
s.description = %q{Gem for managing multiple analytics services in your rails app.}
|
|
14
14
|
s.email = %q{josh@feefighters.com}
|
|
15
15
|
s.extra_rdoc_files = [
|
|
@@ -18,6 +18,8 @@ Gem::Specification.new do |s|
|
|
|
18
18
|
]
|
|
19
19
|
s.files = [
|
|
20
20
|
".document",
|
|
21
|
+
".rspec",
|
|
22
|
+
".rvmrc",
|
|
21
23
|
"Gemfile",
|
|
22
24
|
"Gemfile.lock",
|
|
23
25
|
"Guardfile",
|
|
@@ -26,6 +28,7 @@ Gem::Specification.new do |s|
|
|
|
26
28
|
"Rakefile",
|
|
27
29
|
"VERSION",
|
|
28
30
|
"analytical.gemspec",
|
|
31
|
+
"app/views/application/_analytical_javascript.html.erb",
|
|
29
32
|
"example/.gitignore",
|
|
30
33
|
"example/Gemfile",
|
|
31
34
|
"example/Gemfile.lock",
|
|
@@ -100,6 +103,8 @@ Gem::Specification.new do |s|
|
|
|
100
103
|
"lib/analytical/modules/optimizely.rb",
|
|
101
104
|
"lib/analytical/modules/performancing.rb",
|
|
102
105
|
"lib/analytical/modules/quantcast.rb",
|
|
106
|
+
"lib/analytical/modules/reinvigorate.rb",
|
|
107
|
+
"lib/analytical/rails/engine.rb",
|
|
103
108
|
"lib/analytical/session_command_store.rb",
|
|
104
109
|
"rails/init.rb",
|
|
105
110
|
"spec/analytical/api_spec.rb",
|
|
@@ -116,6 +121,7 @@ Gem::Specification.new do |s|
|
|
|
116
121
|
"spec/analytical/modules/mixpanel_spec.rb",
|
|
117
122
|
"spec/analytical/modules/optimizely_spec.rb",
|
|
118
123
|
"spec/analytical/modules/quantcast.rb",
|
|
124
|
+
"spec/analytical/modules/reinvigorate_spec.rb",
|
|
119
125
|
"spec/analytical/session_command_store_spec.rb",
|
|
120
126
|
"spec/analytical_spec.rb",
|
|
121
127
|
"spec/config/analytical.yml",
|
|
@@ -124,37 +130,54 @@ Gem::Specification.new do |s|
|
|
|
124
130
|
]
|
|
125
131
|
s.homepage = %q{http://github.com/jkrall/analytical}
|
|
126
132
|
s.require_paths = ["lib"]
|
|
127
|
-
s.rubygems_version = %q{1.
|
|
133
|
+
s.rubygems_version = %q{1.6.2}
|
|
128
134
|
s.summary = %q{Gem for managing multiple analytics services in your rails app.}
|
|
129
135
|
|
|
130
136
|
if s.respond_to? :specification_version then
|
|
131
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
132
137
|
s.specification_version = 3
|
|
133
138
|
|
|
134
139
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
140
|
+
s.add_development_dependency(%q<rails>, ["= 3.0.9"])
|
|
141
|
+
s.add_development_dependency(%q<activesupport>, [">= 0"])
|
|
142
|
+
s.add_development_dependency(%q<activemodel>, [">= 0"])
|
|
143
|
+
s.add_development_dependency(%q<rspec>, ["= 2.6.0"])
|
|
144
|
+
s.add_development_dependency(%q<rspec-core>, ["= 2.6.4"])
|
|
145
|
+
s.add_development_dependency(%q<rspec-expectations>, ["= 2.6.0"])
|
|
146
|
+
s.add_development_dependency(%q<rspec-mocks>, ["= 2.6.0"])
|
|
147
|
+
s.add_development_dependency(%q<rspec-rails>, ["= 2.6.0"])
|
|
135
148
|
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
|
136
|
-
s.add_development_dependency(%q<rspec>, ["= 1.3"])
|
|
137
149
|
s.add_development_dependency(%q<diff-lcs>, [">= 0"])
|
|
138
|
-
s.add_development_dependency(%q<rails>, ["~> 2.3"])
|
|
139
150
|
s.add_development_dependency(%q<guard>, [">= 0"])
|
|
140
151
|
s.add_development_dependency(%q<guard-rspec>, [">= 0"])
|
|
141
152
|
s.add_development_dependency(%q<rb-fsevent>, [">= 0"])
|
|
142
153
|
s.add_development_dependency(%q<growl>, [">= 0"])
|
|
143
154
|
else
|
|
155
|
+
s.add_dependency(%q<rails>, ["= 3.0.9"])
|
|
156
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
|
157
|
+
s.add_dependency(%q<activemodel>, [">= 0"])
|
|
158
|
+
s.add_dependency(%q<rspec>, ["= 2.6.0"])
|
|
159
|
+
s.add_dependency(%q<rspec-core>, ["= 2.6.4"])
|
|
160
|
+
s.add_dependency(%q<rspec-expectations>, ["= 2.6.0"])
|
|
161
|
+
s.add_dependency(%q<rspec-mocks>, ["= 2.6.0"])
|
|
162
|
+
s.add_dependency(%q<rspec-rails>, ["= 2.6.0"])
|
|
144
163
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
|
145
|
-
s.add_dependency(%q<rspec>, ["= 1.3"])
|
|
146
164
|
s.add_dependency(%q<diff-lcs>, [">= 0"])
|
|
147
|
-
s.add_dependency(%q<rails>, ["~> 2.3"])
|
|
148
165
|
s.add_dependency(%q<guard>, [">= 0"])
|
|
149
166
|
s.add_dependency(%q<guard-rspec>, [">= 0"])
|
|
150
167
|
s.add_dependency(%q<rb-fsevent>, [">= 0"])
|
|
151
168
|
s.add_dependency(%q<growl>, [">= 0"])
|
|
152
169
|
end
|
|
153
170
|
else
|
|
171
|
+
s.add_dependency(%q<rails>, ["= 3.0.9"])
|
|
172
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
|
173
|
+
s.add_dependency(%q<activemodel>, [">= 0"])
|
|
174
|
+
s.add_dependency(%q<rspec>, ["= 2.6.0"])
|
|
175
|
+
s.add_dependency(%q<rspec-core>, ["= 2.6.4"])
|
|
176
|
+
s.add_dependency(%q<rspec-expectations>, ["= 2.6.0"])
|
|
177
|
+
s.add_dependency(%q<rspec-mocks>, ["= 2.6.0"])
|
|
178
|
+
s.add_dependency(%q<rspec-rails>, ["= 2.6.0"])
|
|
154
179
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
|
155
|
-
s.add_dependency(%q<rspec>, ["= 1.3"])
|
|
156
180
|
s.add_dependency(%q<diff-lcs>, [">= 0"])
|
|
157
|
-
s.add_dependency(%q<rails>, ["~> 2.3"])
|
|
158
181
|
s.add_dependency(%q<guard>, [">= 0"])
|
|
159
182
|
s.add_dependency(%q<guard-rspec>, [">= 0"])
|
|
160
183
|
s.add_dependency(%q<rb-fsevent>, [">= 0"])
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<script type="text/javascript">
|
|
2
|
+
var Analytical = {
|
|
3
|
+
track: function(page) {
|
|
4
|
+
<%= raw analytical.now.track('__PAGE__').gsub(/"__PAGE__"/,'page') %>
|
|
5
|
+
},
|
|
6
|
+
event: function(name, data) {
|
|
7
|
+
if (typeof data === 'undefined') { data = {}; }
|
|
8
|
+
<%= raw analytical.now.event('__EVENT__', {}).gsub(/"__EVENT__"/,'name').gsub(/"?\{\}"?/,'data') %>
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
</script>
|
data/lib/analytical.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require File.dirname(__FILE__)+'/analytical/rails/engine'
|
|
1
2
|
require File.dirname(__FILE__)+'/analytical/modules/base'
|
|
2
3
|
Dir.glob(File.dirname(__FILE__)+'/analytical/**/*.rb').each do |f|
|
|
3
4
|
require f
|
|
@@ -5,53 +6,63 @@ end
|
|
|
5
6
|
|
|
6
7
|
module Analytical
|
|
7
8
|
|
|
8
|
-
# any method placed here will apply to ActionController::Base
|
|
9
9
|
def analytical(options={})
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
File.open("#{Rails.root}/config/analytical.yml") do |f|
|
|
23
|
-
config_options = YAML::load(ERB.new(f.read).result).symbolize_keys
|
|
24
|
-
config_options.each do |k,v|
|
|
25
|
-
config_options[k] = v.symbolize_keys
|
|
26
|
-
end
|
|
27
|
-
end if File.exists?("#{Rails.root}/config/analytical.yml")
|
|
10
|
+
self.analytical_options = options
|
|
11
|
+
|
|
12
|
+
config_options = { :modules => [] }
|
|
13
|
+
File.open("#{::Rails.root}/config/analytical.yml") do |f|
|
|
14
|
+
file_options = YAML::load(ERB.new(f.read).result).symbolize_keys
|
|
15
|
+
env = (::Rails.env || :production).to_sym
|
|
16
|
+
file_options = file_options[env] if file_options.has_key?(env)
|
|
17
|
+
file_options.each do |k, v|
|
|
18
|
+
config_options[k.to_sym] = v.symbolize_keys
|
|
19
|
+
config_options[:modules] << k.to_sym unless options && options[:modules]
|
|
20
|
+
end if file_options
|
|
21
|
+
end if File.exists?("#{::Rails.root}/config/analytical.yml")
|
|
28
22
|
|
|
29
23
|
self.analytical_options = self.analytical_options.reverse_merge config_options
|
|
30
24
|
end
|
|
31
25
|
|
|
32
26
|
module InstanceMethods
|
|
33
|
-
# any method placed here will apply to instances
|
|
34
|
-
|
|
35
27
|
def analytical
|
|
36
28
|
@analytical ||= begin
|
|
37
29
|
options = self.class.analytical_options.merge({
|
|
38
30
|
:ssl => request.ssl?,
|
|
39
31
|
:controller => self,
|
|
40
32
|
})
|
|
41
|
-
if options[:disable_if].call(self)
|
|
42
|
-
options[:modules] =
|
|
33
|
+
if options[:disable_if] && options[:disable_if].call(self)
|
|
34
|
+
options[:modules] = []
|
|
43
35
|
end
|
|
44
36
|
options[:session] = session if options[:use_session_store]
|
|
45
37
|
if analytical_is_robot?(request.user_agent)
|
|
46
38
|
options[:modules] = []
|
|
47
39
|
end
|
|
40
|
+
options[:modules] = options[:filter_modules].call(self, options[:modules]) if options[:filter_modules]
|
|
41
|
+
options[:javascript_helpers] ||= true
|
|
48
42
|
Analytical::Api.new options
|
|
49
43
|
end
|
|
50
44
|
end
|
|
51
45
|
end
|
|
52
46
|
|
|
47
|
+
module HelperMethods
|
|
48
|
+
def analytical
|
|
49
|
+
controller.analytical
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
if defined?(ActionController::Base)
|
|
56
|
-
ActionController::Base.
|
|
56
|
+
ActionController::Base.class_eval do
|
|
57
|
+
extend Analytical
|
|
58
|
+
include Analytical::InstanceMethods
|
|
59
|
+
include Analytical::BotDetector
|
|
60
|
+
helper Analytical::HelperMethods
|
|
61
|
+
|
|
62
|
+
if ::Rails::VERSION::MAJOR < 3
|
|
63
|
+
class_inheritable_accessor :analytical_options
|
|
64
|
+
else
|
|
65
|
+
class_attribute :analytical_options
|
|
66
|
+
end
|
|
67
|
+
end
|
|
57
68
|
end
|
data/lib/analytical/api.rb
CHANGED
|
@@ -48,7 +48,7 @@ module Analytical
|
|
|
48
48
|
def method_missing(method, *args, &block)
|
|
49
49
|
@parent.modules.values.collect do |m|
|
|
50
50
|
m.send(method, *args) if m.respond_to?(method)
|
|
51
|
-
end.
|
|
51
|
+
end.delete_if{|c| c.blank?}.join("\n")
|
|
52
52
|
end
|
|
53
53
|
end
|
|
54
54
|
|
|
@@ -67,7 +67,21 @@ module Analytical
|
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
def head_append_javascript
|
|
70
|
-
|
|
70
|
+
js = [
|
|
71
|
+
init_javascript(:head_append),
|
|
72
|
+
tracking_javascript(:head_append),
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
if options[:javascript_helpers]
|
|
76
|
+
if ::Rails::VERSION::MAJOR >= 3 && ::Rails::VERSION::MINOR >= 1 # Rails 3.1 lets us override views in engines
|
|
77
|
+
js << options[:controller].send(:render_to_string, :partial=>'analytical_javascript') if options[:controller]
|
|
78
|
+
else # All other rails
|
|
79
|
+
_partial_path = Pathname.new(__FILE__).dirname.join('..', '..', 'app/views/application', 'analytical_javascript.html.erb').to_s
|
|
80
|
+
js << options[:controller].send(:render_to_string, :partial=>_partial_path) if options[:controller]
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
js.delete_if{|s| s.blank?}.join("\n")
|
|
71
85
|
end
|
|
72
86
|
|
|
73
87
|
alias_method :head_javascript, :head_append_javascript
|
|
@@ -103,7 +117,7 @@ module Analytical
|
|
|
103
117
|
def init_javascript(location)
|
|
104
118
|
@modules.values.collect do |m|
|
|
105
119
|
m.init_javascript(location) if m.respond_to?(:init_javascript)
|
|
106
|
-
end.
|
|
120
|
+
end.delete_if{|c| c.blank?}.join
|
|
107
121
|
end
|
|
108
122
|
|
|
109
123
|
def available_modules
|
|
@@ -12,9 +12,18 @@ module Analytical
|
|
|
12
12
|
init_location(location) do
|
|
13
13
|
js = <<-HTML
|
|
14
14
|
<!-- Analytical Init: Clicky -->
|
|
15
|
-
<script
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
<script type="text/javascript">
|
|
16
|
+
var clicky_site_ids = clicky_site_ids || [];
|
|
17
|
+
clicky_site_ids.push(#{@options[:key]});
|
|
18
|
+
(function() {
|
|
19
|
+
var s = document.createElement('script');
|
|
20
|
+
s.type = 'text/javascript';
|
|
21
|
+
s.async = true;
|
|
22
|
+
s.src = '//static.getclicky.com/js';
|
|
23
|
+
( document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0] ).appendChild( s );
|
|
24
|
+
})();
|
|
25
|
+
</script>
|
|
26
|
+
<noscript><p><img alt="Clicky" width="1" height="1" src="//in.getclicky.com/#{@options[:key]}ns.gif" /></p></noscript>
|
|
18
27
|
HTML
|
|
19
28
|
|
|
20
29
|
identify_commands = []
|
|
@@ -34,8 +34,9 @@ module Analytical
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def event(name, *args)
|
|
37
|
-
data = args.first ||
|
|
38
|
-
|
|
37
|
+
data = args.first || {}
|
|
38
|
+
data = data[:value] if data.is_a?(Hash)
|
|
39
|
+
data_string = !data.nil? ? ", #{data}" : ""
|
|
39
40
|
"_gaq.push(['_trackEvent', \"Event\", \"#{name}\"" + data_string + "]);"
|
|
40
41
|
end
|
|
41
42
|
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
module Analytical
|
|
2
|
+
module Modules
|
|
3
|
+
class Reinvigorate
|
|
4
|
+
include Analytical::Modules::Base
|
|
5
|
+
|
|
6
|
+
def initialize(options={})
|
|
7
|
+
super
|
|
8
|
+
@tracking_command_location = :body_append
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def init_javascript(location)
|
|
12
|
+
init_location(location) do
|
|
13
|
+
js = <<-HTML
|
|
14
|
+
<!-- Analytical Init: Reinvigorate -->
|
|
15
|
+
<script type="text/javascript">
|
|
16
|
+
document.write(unescape("%3Cscript src='" + (("https:" == document.location.protocol) ? "https://ssl-" : "http://")
|
|
17
|
+
+ "include.reinvigorate.net/re_.js' type='text/javascript'%3E%3C/script%3E"));
|
|
18
|
+
</script>
|
|
19
|
+
HTML
|
|
20
|
+
js
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def identify(id, *args)
|
|
25
|
+
data = args.first || {}
|
|
26
|
+
"var re_name_tag = \"#{id}\";"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def context(data)
|
|
30
|
+
return '' if data.blank?
|
|
31
|
+
if data[:email]
|
|
32
|
+
"var re_context_tag = \"mailto:#{data[:email]}\";"
|
|
33
|
+
elsif data[:url]
|
|
34
|
+
"var re_context_tag = \"http://#{data[:url]}\";"
|
|
35
|
+
else
|
|
36
|
+
"var re_context_tag = \"#{data.first.last}\";"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def track(data, *args)
|
|
41
|
+
"try {
|
|
42
|
+
reinvigorate.track(\"#{options[:key]}\");
|
|
43
|
+
} catch(err) {}"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
data/spec/analytical/api_spec.rb
CHANGED
|
@@ -101,7 +101,7 @@ describe "Analytical::Api" do
|
|
|
101
101
|
it 'should return the javascript' do
|
|
102
102
|
@console.should_receive(:init_javascript).with(:head_prepend).and_return('console_a')
|
|
103
103
|
@google.should_receive(:init_javascript).with(:head_prepend).and_return('google_a')
|
|
104
|
-
@api.head_prepend_javascript.should == "
|
|
104
|
+
@api.head_prepend_javascript.should == "console_agoogle_a"
|
|
105
105
|
end
|
|
106
106
|
end
|
|
107
107
|
|
|
@@ -109,7 +109,7 @@ describe "Analytical::Api" do
|
|
|
109
109
|
it 'should return the javascript' do
|
|
110
110
|
@console.should_receive(:init_javascript).with(:head_append).and_return('console_a')
|
|
111
111
|
@google.should_receive(:init_javascript).with(:head_append).and_return('google_a')
|
|
112
|
-
@api.head_append_javascript.should == "
|
|
112
|
+
@api.head_append_javascript.should == "console_agoogle_a"
|
|
113
113
|
end
|
|
114
114
|
end
|
|
115
115
|
|
|
@@ -117,14 +117,14 @@ describe "Analytical::Api" do
|
|
|
117
117
|
it 'should return the javascript' do
|
|
118
118
|
@console.should_receive(:init_javascript).with(:body_prepend).and_return('console_b')
|
|
119
119
|
@google.should_receive(:init_javascript).with(:body_prepend).and_return('google_b')
|
|
120
|
-
@api.body_prepend_javascript.should == "
|
|
120
|
+
@api.body_prepend_javascript.should == "console_bgoogle_b"
|
|
121
121
|
end
|
|
122
122
|
end
|
|
123
123
|
describe '#body_append_javascript' do
|
|
124
124
|
it 'should return the javascript' do
|
|
125
125
|
@console.should_receive(:init_javascript).with(:body_append).and_return('console_c')
|
|
126
126
|
@google.should_receive(:init_javascript).with(:body_append).and_return('google_c')
|
|
127
|
-
@api.body_append_javascript.should == "
|
|
127
|
+
@api.body_append_javascript.should == "console_cgoogle_c"
|
|
128
128
|
end
|
|
129
129
|
end
|
|
130
130
|
describe 'with stored commands' do
|
|
@@ -145,7 +145,7 @@ describe "Analytical::Api" do
|
|
|
145
145
|
it 'should return the javascript' do
|
|
146
146
|
@console.should_receive(:init_javascript).with(:body_prepend).and_return('console_b')
|
|
147
147
|
@google.should_receive(:init_javascript).with(:body_prepend).and_return('google_b')
|
|
148
|
-
@api.body_prepend_javascript.should == "
|
|
148
|
+
@api.body_prepend_javascript.should == "console_bgoogle_b\n<script type='text/javascript'>\nconsole track called\ngoogle track called\n</script>"
|
|
149
149
|
end
|
|
150
150
|
end
|
|
151
151
|
end
|
|
@@ -27,10 +27,19 @@ describe "Analytical::Modules::Google" do
|
|
|
27
27
|
@api.event('pagename').should == "_gaq.push(['_trackEvent', \"Event\", \"pagename\"]);"
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
it 'should include
|
|
30
|
+
it 'should include data value' do
|
|
31
31
|
@api = Analytical::Modules::Google.new :parent=>@parent, :key=>'abcdef'
|
|
32
|
-
@api.event('pagename', {:
|
|
32
|
+
@api.event('pagename', {:value=>555, :more=>'info'}).should == "_gaq.push(['_trackEvent', \"Event\", \"pagename\", 555]);"
|
|
33
33
|
end
|
|
34
|
+
it 'should not include data if there is no value' do
|
|
35
|
+
@api = Analytical::Modules::Google.new :parent=>@parent, :key=>'abcdef'
|
|
36
|
+
@api.event('pagename', {:more=>'info'}).should == "_gaq.push(['_trackEvent', \"Event\", \"pagename\"]);"
|
|
37
|
+
end
|
|
38
|
+
it 'should not include data if it is not a hash' do
|
|
39
|
+
@api = Analytical::Modules::Google.new :parent=>@parent, :key=>'abcdef'
|
|
40
|
+
@api.event('pagename', 555).should == "_gaq.push(['_trackEvent', \"Event\", \"pagename\", 555]);"
|
|
41
|
+
end
|
|
42
|
+
|
|
34
43
|
end
|
|
35
44
|
describe '#init_javascript' do
|
|
36
45
|
it 'should return the init javascript' do
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
2
|
+
|
|
3
|
+
describe "Analytical::Modules::Reinvigorate" do
|
|
4
|
+
|
|
5
|
+
before(:each) do
|
|
6
|
+
@parent = mock('api', :options=>{:reinvigorate=>{:key=>'abc'}})
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe 'on initialize' do
|
|
10
|
+
|
|
11
|
+
it 'should set the command_location' do
|
|
12
|
+
a = Analytical::Modules::Reinvigorate.new :parent=>@parent, :key=>'abc'
|
|
13
|
+
a.tracking_command_location.should == :body_append
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it 'should set the options' do
|
|
17
|
+
a = Analytical::Modules::Reinvigorate.new :parent=>@parent, :key=>'abc'
|
|
18
|
+
a.options.should == {:key=>'abc', :parent=>@parent}
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
describe '#init_javascript' do
|
|
24
|
+
|
|
25
|
+
it 'should return the init javascript' do
|
|
26
|
+
@api = Analytical::Modules::Reinvigorate.new :parent=>@parent, :key=>'abcdef'
|
|
27
|
+
@api.init_javascript(:head_prepend).should == ''
|
|
28
|
+
@api.init_javascript(:head_append).should == ''
|
|
29
|
+
@api.init_javascript(:body_prepend).should == ''
|
|
30
|
+
@api.init_javascript(:body_append).should =~ /reinvigorate/
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
end
|
data/spec/analytical_spec.rb
CHANGED
|
@@ -2,39 +2,53 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
|
2
2
|
require 'ostruct'
|
|
3
3
|
|
|
4
4
|
describe "Analytical" do
|
|
5
|
-
before(:each) do
|
|
6
|
-
rails_env = mock('rails environment', :'production?'=>true, :'development?'=>false)
|
|
7
|
-
Rails.stub!(:env).and_return(rails_env)
|
|
8
|
-
File.stub!(:'exists?').and_return(false)
|
|
9
|
-
end
|
|
10
|
-
|
|
11
5
|
describe 'on initialization' do
|
|
12
6
|
class DummyForInit
|
|
13
7
|
extend Analytical
|
|
8
|
+
include Analytical::InstanceMethods
|
|
9
|
+
include Analytical::BotDetector
|
|
10
|
+
if ::Rails::VERSION::MAJOR < 3
|
|
11
|
+
class_inheritable_accessor :analytical_options
|
|
12
|
+
else
|
|
13
|
+
class_attribute :analytical_options
|
|
14
|
+
end
|
|
15
|
+
|
|
14
16
|
def self.helper_method(*a); end
|
|
15
17
|
def request
|
|
16
|
-
|
|
18
|
+
RSpec::Mocks::Mock.new 'request',
|
|
17
19
|
:'ssl?'=>true,
|
|
18
20
|
:user_agent=>'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 GTB7.0'
|
|
19
21
|
end
|
|
20
22
|
end
|
|
21
23
|
|
|
22
|
-
it 'should have the
|
|
24
|
+
it 'should have the options from analytical.yml' do
|
|
23
25
|
DummyForInit.analytical
|
|
24
26
|
d = DummyForInit.new.analytical
|
|
25
|
-
d.options[:modules].should == []
|
|
26
|
-
d.options[:development_modules].should == [:console]
|
|
27
|
-
d.options[:disable_if].call.should be_false
|
|
27
|
+
d.options[:modules].sort_by { |m| m.to_s }.should == [:chartbeat, :clicky, :google, :kiss_metrics]
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
it 'should use the supplied options' do
|
|
31
31
|
DummyForInit.analytical :modules=>[:google]
|
|
32
32
|
d = DummyForInit.new.analytical
|
|
33
33
|
d.options[:modules].should == [:google]
|
|
34
|
-
d.options[:development_modules].should == [:console]
|
|
35
|
-
d.options[:disable_if].call.should be_false
|
|
36
34
|
end
|
|
37
35
|
|
|
36
|
+
describe 'conditionally disabled' do
|
|
37
|
+
it 'should set the modules to []' do
|
|
38
|
+
DummyForInit.analytical :disable_if => lambda { |x| true }
|
|
39
|
+
d = DummyForInit.new
|
|
40
|
+
d.analytical.options[:modules].should == []
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
describe 'with filtered modules' do
|
|
45
|
+
it 'should set the modules to []' do
|
|
46
|
+
DummyForInit.analytical :filter_modules => lambda { |x, modules| modules - [:clicky] }
|
|
47
|
+
d = DummyForInit.new
|
|
48
|
+
d.analytical.options[:modules].include?(:clicky).should be_false
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
38
52
|
describe 'with a robot request' do
|
|
39
53
|
it 'should set the modules to []' do
|
|
40
54
|
DummyForInit.analytical
|
|
@@ -53,6 +67,11 @@ describe "Analytical" do
|
|
|
53
67
|
DummyForInit.analytical_options[:chartbeat].should == {:key=>'chartbeat_12345', :domain => 'your.domain.com'}
|
|
54
68
|
end
|
|
55
69
|
|
|
70
|
+
it 'should allow for module-specific controller overrides' do
|
|
71
|
+
DummyForInit.analytical :google=>{:key=>'override_google_key'}
|
|
72
|
+
DummyForInit.analytical_options[:google].should == {:key=>'override_google_key'}
|
|
73
|
+
end
|
|
74
|
+
|
|
56
75
|
describe 'in production mode' do
|
|
57
76
|
before(:each) do
|
|
58
77
|
Rails.env.stub!(:production?).and_return(true)
|
|
@@ -64,7 +83,7 @@ describe "Analytical" do
|
|
|
64
83
|
end
|
|
65
84
|
end
|
|
66
85
|
|
|
67
|
-
describe 'in
|
|
86
|
+
describe 'in non-production mode' do
|
|
68
87
|
before(:each) do
|
|
69
88
|
Rails.env.stub!(:production?).and_return(false)
|
|
70
89
|
end
|
|
@@ -74,6 +93,16 @@ describe "Analytical" do
|
|
|
74
93
|
end
|
|
75
94
|
end
|
|
76
95
|
|
|
96
|
+
describe 'in development mode' do
|
|
97
|
+
before(:each) do
|
|
98
|
+
Rails.stub!(:env).and_return(:development)
|
|
99
|
+
end
|
|
100
|
+
it 'should start with no modules' do
|
|
101
|
+
DummyForInit.analytical
|
|
102
|
+
DummyForInit.new.analytical.options[:modules] = []
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
77
106
|
end
|
|
78
107
|
|
|
79
108
|
end
|
data/spec/config/analytical.yml
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
test:
|
|
2
|
+
google:
|
|
3
|
+
key: google_12345
|
|
4
|
+
clicky:
|
|
5
|
+
key: clicky_12345
|
|
6
|
+
kiss_metrics:
|
|
7
|
+
key: kiss_metrics_12345
|
|
8
|
+
chartbeat:
|
|
9
|
+
key: chartbeat_12345
|
|
10
|
+
domain: your.domain.com
|
|
11
|
+
|
|
12
|
+
production:
|
|
13
|
+
|
|
14
|
+
development:
|
|
15
|
+
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
|
|
3
|
+
ENV["RAILS_ENV"] ||= 'test'
|
|
4
|
+
|
|
3
5
|
require 'active_support'
|
|
4
6
|
require 'active_support/core_ext'
|
|
5
7
|
require 'active_support/json'
|
|
6
8
|
require 'action_view'
|
|
7
|
-
require '
|
|
8
|
-
require '
|
|
9
|
-
|
|
10
|
-
require '
|
|
9
|
+
require 'active_model'
|
|
10
|
+
require 'action_controller'
|
|
11
|
+
require 'rails'
|
|
12
|
+
require 'rspec/rails'
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
File.dirname(__FILE__)
|
|
14
|
+
RSpec.configure do |config|
|
|
15
|
+
config.mock_with :rspec
|
|
16
|
+
config.expect_with :rspec
|
|
17
|
+
config.before do
|
|
18
|
+
Rails.stub(:root).and_return(Pathname.new(__FILE__).dirname)
|
|
18
19
|
end
|
|
19
20
|
end
|
|
21
|
+
|
|
22
|
+
require 'analytical'
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: analytical
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
5
|
-
prerelease:
|
|
4
|
+
hash: 11
|
|
5
|
+
prerelease:
|
|
6
6
|
segments:
|
|
7
|
-
-
|
|
8
|
-
- 11
|
|
7
|
+
- 3
|
|
9
8
|
- 0
|
|
10
|
-
|
|
9
|
+
- 6
|
|
10
|
+
version: 3.0.6
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Joshua Krall
|
|
@@ -17,46 +17,45 @@ authors:
|
|
|
17
17
|
- Ablyamitov Ablyamit
|
|
18
18
|
- Kurt Werle
|
|
19
19
|
- Olivier Lauzon
|
|
20
|
+
- Daniel Doubrovkine
|
|
20
21
|
autorequire:
|
|
21
22
|
bindir: bin
|
|
22
23
|
cert_chain: []
|
|
23
24
|
|
|
24
|
-
date: 2011-
|
|
25
|
+
date: 2011-08-08 00:00:00 -05:00
|
|
25
26
|
default_executable:
|
|
26
27
|
dependencies:
|
|
27
28
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
type: :development
|
|
29
|
-
prerelease: false
|
|
30
|
-
name: jeweler
|
|
31
29
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
|
32
30
|
none: false
|
|
33
31
|
requirements:
|
|
34
|
-
- - "
|
|
32
|
+
- - "="
|
|
35
33
|
- !ruby/object:Gem::Version
|
|
36
|
-
hash:
|
|
34
|
+
hash: 21
|
|
37
35
|
segments:
|
|
36
|
+
- 3
|
|
38
37
|
- 0
|
|
39
|
-
|
|
38
|
+
- 9
|
|
39
|
+
version: 3.0.9
|
|
40
40
|
requirement: *id001
|
|
41
|
-
- !ruby/object:Gem::Dependency
|
|
42
41
|
type: :development
|
|
43
42
|
prerelease: false
|
|
44
|
-
name:
|
|
43
|
+
name: rails
|
|
44
|
+
- !ruby/object:Gem::Dependency
|
|
45
45
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
|
46
46
|
none: false
|
|
47
47
|
requirements:
|
|
48
|
-
- - "
|
|
48
|
+
- - ">="
|
|
49
49
|
- !ruby/object:Gem::Version
|
|
50
|
-
hash:
|
|
50
|
+
hash: 3
|
|
51
51
|
segments:
|
|
52
|
-
-
|
|
53
|
-
|
|
54
|
-
version: "1.3"
|
|
52
|
+
- 0
|
|
53
|
+
version: "0"
|
|
55
54
|
requirement: *id002
|
|
56
|
-
- !ruby/object:Gem::Dependency
|
|
57
55
|
type: :development
|
|
58
56
|
prerelease: false
|
|
59
|
-
name:
|
|
57
|
+
name: activesupport
|
|
58
|
+
- !ruby/object:Gem::Dependency
|
|
60
59
|
version_requirements: &id003 !ruby/object:Gem::Requirement
|
|
61
60
|
none: false
|
|
62
61
|
requirements:
|
|
@@ -67,26 +66,91 @@ dependencies:
|
|
|
67
66
|
- 0
|
|
68
67
|
version: "0"
|
|
69
68
|
requirement: *id003
|
|
70
|
-
- !ruby/object:Gem::Dependency
|
|
71
69
|
type: :development
|
|
72
70
|
prerelease: false
|
|
73
|
-
name:
|
|
71
|
+
name: activemodel
|
|
72
|
+
- !ruby/object:Gem::Dependency
|
|
74
73
|
version_requirements: &id004 !ruby/object:Gem::Requirement
|
|
75
74
|
none: false
|
|
76
75
|
requirements:
|
|
77
|
-
- -
|
|
76
|
+
- - "="
|
|
78
77
|
- !ruby/object:Gem::Version
|
|
79
|
-
hash:
|
|
78
|
+
hash: 23
|
|
80
79
|
segments:
|
|
81
80
|
- 2
|
|
82
|
-
-
|
|
83
|
-
|
|
81
|
+
- 6
|
|
82
|
+
- 0
|
|
83
|
+
version: 2.6.0
|
|
84
84
|
requirement: *id004
|
|
85
|
-
- !ruby/object:Gem::Dependency
|
|
86
85
|
type: :development
|
|
87
86
|
prerelease: false
|
|
88
|
-
name:
|
|
87
|
+
name: rspec
|
|
88
|
+
- !ruby/object:Gem::Dependency
|
|
89
89
|
version_requirements: &id005 !ruby/object:Gem::Requirement
|
|
90
|
+
none: false
|
|
91
|
+
requirements:
|
|
92
|
+
- - "="
|
|
93
|
+
- !ruby/object:Gem::Version
|
|
94
|
+
hash: 31
|
|
95
|
+
segments:
|
|
96
|
+
- 2
|
|
97
|
+
- 6
|
|
98
|
+
- 4
|
|
99
|
+
version: 2.6.4
|
|
100
|
+
requirement: *id005
|
|
101
|
+
type: :development
|
|
102
|
+
prerelease: false
|
|
103
|
+
name: rspec-core
|
|
104
|
+
- !ruby/object:Gem::Dependency
|
|
105
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
|
106
|
+
none: false
|
|
107
|
+
requirements:
|
|
108
|
+
- - "="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
hash: 23
|
|
111
|
+
segments:
|
|
112
|
+
- 2
|
|
113
|
+
- 6
|
|
114
|
+
- 0
|
|
115
|
+
version: 2.6.0
|
|
116
|
+
requirement: *id006
|
|
117
|
+
type: :development
|
|
118
|
+
prerelease: false
|
|
119
|
+
name: rspec-expectations
|
|
120
|
+
- !ruby/object:Gem::Dependency
|
|
121
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
|
122
|
+
none: false
|
|
123
|
+
requirements:
|
|
124
|
+
- - "="
|
|
125
|
+
- !ruby/object:Gem::Version
|
|
126
|
+
hash: 23
|
|
127
|
+
segments:
|
|
128
|
+
- 2
|
|
129
|
+
- 6
|
|
130
|
+
- 0
|
|
131
|
+
version: 2.6.0
|
|
132
|
+
requirement: *id007
|
|
133
|
+
type: :development
|
|
134
|
+
prerelease: false
|
|
135
|
+
name: rspec-mocks
|
|
136
|
+
- !ruby/object:Gem::Dependency
|
|
137
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
|
138
|
+
none: false
|
|
139
|
+
requirements:
|
|
140
|
+
- - "="
|
|
141
|
+
- !ruby/object:Gem::Version
|
|
142
|
+
hash: 23
|
|
143
|
+
segments:
|
|
144
|
+
- 2
|
|
145
|
+
- 6
|
|
146
|
+
- 0
|
|
147
|
+
version: 2.6.0
|
|
148
|
+
requirement: *id008
|
|
149
|
+
type: :development
|
|
150
|
+
prerelease: false
|
|
151
|
+
name: rspec-rails
|
|
152
|
+
- !ruby/object:Gem::Dependency
|
|
153
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
|
90
154
|
none: false
|
|
91
155
|
requirements:
|
|
92
156
|
- - ">="
|
|
@@ -95,12 +159,12 @@ dependencies:
|
|
|
95
159
|
segments:
|
|
96
160
|
- 0
|
|
97
161
|
version: "0"
|
|
98
|
-
requirement: *
|
|
99
|
-
- !ruby/object:Gem::Dependency
|
|
162
|
+
requirement: *id009
|
|
100
163
|
type: :development
|
|
101
164
|
prerelease: false
|
|
102
|
-
name:
|
|
103
|
-
|
|
165
|
+
name: jeweler
|
|
166
|
+
- !ruby/object:Gem::Dependency
|
|
167
|
+
version_requirements: &id010 !ruby/object:Gem::Requirement
|
|
104
168
|
none: false
|
|
105
169
|
requirements:
|
|
106
170
|
- - ">="
|
|
@@ -109,12 +173,26 @@ dependencies:
|
|
|
109
173
|
segments:
|
|
110
174
|
- 0
|
|
111
175
|
version: "0"
|
|
112
|
-
requirement: *
|
|
176
|
+
requirement: *id010
|
|
177
|
+
type: :development
|
|
178
|
+
prerelease: false
|
|
179
|
+
name: diff-lcs
|
|
113
180
|
- !ruby/object:Gem::Dependency
|
|
181
|
+
version_requirements: &id011 !ruby/object:Gem::Requirement
|
|
182
|
+
none: false
|
|
183
|
+
requirements:
|
|
184
|
+
- - ">="
|
|
185
|
+
- !ruby/object:Gem::Version
|
|
186
|
+
hash: 3
|
|
187
|
+
segments:
|
|
188
|
+
- 0
|
|
189
|
+
version: "0"
|
|
190
|
+
requirement: *id011
|
|
114
191
|
type: :development
|
|
115
192
|
prerelease: false
|
|
116
|
-
name:
|
|
117
|
-
|
|
193
|
+
name: guard
|
|
194
|
+
- !ruby/object:Gem::Dependency
|
|
195
|
+
version_requirements: &id012 !ruby/object:Gem::Requirement
|
|
118
196
|
none: false
|
|
119
197
|
requirements:
|
|
120
198
|
- - ">="
|
|
@@ -123,12 +201,26 @@ dependencies:
|
|
|
123
201
|
segments:
|
|
124
202
|
- 0
|
|
125
203
|
version: "0"
|
|
126
|
-
requirement: *
|
|
204
|
+
requirement: *id012
|
|
205
|
+
type: :development
|
|
206
|
+
prerelease: false
|
|
207
|
+
name: guard-rspec
|
|
127
208
|
- !ruby/object:Gem::Dependency
|
|
209
|
+
version_requirements: &id013 !ruby/object:Gem::Requirement
|
|
210
|
+
none: false
|
|
211
|
+
requirements:
|
|
212
|
+
- - ">="
|
|
213
|
+
- !ruby/object:Gem::Version
|
|
214
|
+
hash: 3
|
|
215
|
+
segments:
|
|
216
|
+
- 0
|
|
217
|
+
version: "0"
|
|
218
|
+
requirement: *id013
|
|
128
219
|
type: :development
|
|
129
220
|
prerelease: false
|
|
130
|
-
name:
|
|
131
|
-
|
|
221
|
+
name: rb-fsevent
|
|
222
|
+
- !ruby/object:Gem::Dependency
|
|
223
|
+
version_requirements: &id014 !ruby/object:Gem::Requirement
|
|
132
224
|
none: false
|
|
133
225
|
requirements:
|
|
134
226
|
- - ">="
|
|
@@ -137,7 +229,10 @@ dependencies:
|
|
|
137
229
|
segments:
|
|
138
230
|
- 0
|
|
139
231
|
version: "0"
|
|
140
|
-
requirement: *
|
|
232
|
+
requirement: *id014
|
|
233
|
+
type: :development
|
|
234
|
+
prerelease: false
|
|
235
|
+
name: growl
|
|
141
236
|
description: Gem for managing multiple analytics services in your rails app.
|
|
142
237
|
email: josh@feefighters.com
|
|
143
238
|
executables: []
|
|
@@ -149,6 +244,8 @@ extra_rdoc_files:
|
|
|
149
244
|
- README.rdoc
|
|
150
245
|
files:
|
|
151
246
|
- .document
|
|
247
|
+
- .rspec
|
|
248
|
+
- .rvmrc
|
|
152
249
|
- Gemfile
|
|
153
250
|
- Gemfile.lock
|
|
154
251
|
- Guardfile
|
|
@@ -157,6 +254,7 @@ files:
|
|
|
157
254
|
- Rakefile
|
|
158
255
|
- VERSION
|
|
159
256
|
- analytical.gemspec
|
|
257
|
+
- app/views/application/_analytical_javascript.html.erb
|
|
160
258
|
- example/.gitignore
|
|
161
259
|
- example/Gemfile
|
|
162
260
|
- example/Gemfile.lock
|
|
@@ -231,6 +329,8 @@ files:
|
|
|
231
329
|
- lib/analytical/modules/optimizely.rb
|
|
232
330
|
- lib/analytical/modules/performancing.rb
|
|
233
331
|
- lib/analytical/modules/quantcast.rb
|
|
332
|
+
- lib/analytical/modules/reinvigorate.rb
|
|
333
|
+
- lib/analytical/rails/engine.rb
|
|
234
334
|
- lib/analytical/session_command_store.rb
|
|
235
335
|
- rails/init.rb
|
|
236
336
|
- spec/analytical/api_spec.rb
|
|
@@ -247,6 +347,7 @@ files:
|
|
|
247
347
|
- spec/analytical/modules/mixpanel_spec.rb
|
|
248
348
|
- spec/analytical/modules/optimizely_spec.rb
|
|
249
349
|
- spec/analytical/modules/quantcast.rb
|
|
350
|
+
- spec/analytical/modules/reinvigorate_spec.rb
|
|
250
351
|
- spec/analytical/session_command_store_spec.rb
|
|
251
352
|
- spec/analytical_spec.rb
|
|
252
353
|
- spec/config/analytical.yml
|
|
@@ -282,7 +383,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
282
383
|
requirements: []
|
|
283
384
|
|
|
284
385
|
rubyforge_project:
|
|
285
|
-
rubygems_version: 1.
|
|
386
|
+
rubygems_version: 1.6.2
|
|
286
387
|
signing_key:
|
|
287
388
|
specification_version: 3
|
|
288
389
|
summary: Gem for managing multiple analytics services in your rails app.
|