analytical 1.8.0 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/analytical.gemspec +29 -29
- data/lib/analytical.rb +2 -2
- data/lib/analytical/api.rb +2 -2
- data/lib/analytical/{adwords.rb → modules/adwords.rb} +5 -5
- data/lib/analytical/{base.rb → modules/base.rb} +7 -4
- data/lib/analytical/{chartbeat.rb → modules/chartbeat.rb} +3 -3
- data/lib/analytical/{clicky.rb → modules/clicky.rb} +3 -5
- data/lib/analytical/{comscore.rb → modules/comscore.rb} +3 -3
- data/lib/analytical/{console.rb → modules/console.rb} +3 -3
- data/lib/analytical/{crazy_egg.rb → modules/crazy_egg.rb} +3 -4
- data/lib/analytical/{google.rb → modules/google.rb} +3 -3
- data/lib/analytical/{hubspot.rb → modules/hubspot.rb} +3 -3
- data/lib/analytical/{kiss_metrics.rb → modules/kiss_metrics.rb} +3 -3
- data/lib/analytical/{optimizely.rb → modules/optimizely.rb} +3 -3
- data/spec/analytical/api_spec.rb +7 -7
- data/spec/analytical/{base_spec.rb → modules/base_spec.rb} +18 -3
- data/spec/analytical/{chartbeat_spec.rb → modules/chartbeat_spec.rb} +5 -5
- data/spec/analytical/{clicky_spec.rb → modules/clicky_spec.rb} +9 -9
- data/spec/analytical/{comscore_spec.rb → modules/comscore_spec.rb} +5 -5
- data/spec/analytical/{google_spec.rb → modules/google_spec.rb} +6 -6
- data/spec/analytical/{kiss_metrics_spec.rb → modules/kiss_metrics_spec.rb} +9 -9
- data/spec/analytical/{optimizely_spec.rb → modules/optimizely_spec.rb} +5 -5
- metadata +29 -38
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.9.0
|
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 = "1.
|
8
|
+
s.version = "1.9.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Joshua Krall", "Nathan Phelps", "Adam Anderson"]
|
12
|
-
s.date = %q{2010-09-
|
12
|
+
s.date = %q{2010-09-29}
|
13
13
|
s.description = %q{Gem for managing multiple analytics services in your rails app.}
|
14
14
|
s.email = %q{josh@transfs.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -75,29 +75,29 @@ Gem::Specification.new do |s|
|
|
75
75
|
"example/test/unit/helpers/page_helper_test.rb",
|
76
76
|
"example/vendor/plugins/.gitkeep",
|
77
77
|
"lib/analytical.rb",
|
78
|
-
"lib/analytical/adwords.rb",
|
79
78
|
"lib/analytical/api.rb",
|
80
|
-
"lib/analytical/base.rb",
|
81
79
|
"lib/analytical/bot_detector.rb",
|
82
|
-
"lib/analytical/
|
83
|
-
"lib/analytical/
|
84
|
-
"lib/analytical/
|
85
|
-
"lib/analytical/
|
86
|
-
"lib/analytical/
|
87
|
-
"lib/analytical/
|
88
|
-
"lib/analytical/
|
89
|
-
"lib/analytical/
|
90
|
-
"lib/analytical/
|
80
|
+
"lib/analytical/modules/adwords.rb",
|
81
|
+
"lib/analytical/modules/base.rb",
|
82
|
+
"lib/analytical/modules/chartbeat.rb",
|
83
|
+
"lib/analytical/modules/clicky.rb",
|
84
|
+
"lib/analytical/modules/comscore.rb",
|
85
|
+
"lib/analytical/modules/console.rb",
|
86
|
+
"lib/analytical/modules/crazy_egg.rb",
|
87
|
+
"lib/analytical/modules/google.rb",
|
88
|
+
"lib/analytical/modules/hubspot.rb",
|
89
|
+
"lib/analytical/modules/kiss_metrics.rb",
|
90
|
+
"lib/analytical/modules/optimizely.rb",
|
91
91
|
"rails/init.rb",
|
92
92
|
"spec/analytical/api_spec.rb",
|
93
|
-
"spec/analytical/base_spec.rb",
|
94
93
|
"spec/analytical/bot_detector_spec.rb",
|
95
|
-
"spec/analytical/
|
96
|
-
"spec/analytical/
|
97
|
-
"spec/analytical/
|
98
|
-
"spec/analytical/
|
99
|
-
"spec/analytical/
|
100
|
-
"spec/analytical/
|
94
|
+
"spec/analytical/modules/base_spec.rb",
|
95
|
+
"spec/analytical/modules/chartbeat_spec.rb",
|
96
|
+
"spec/analytical/modules/clicky_spec.rb",
|
97
|
+
"spec/analytical/modules/comscore_spec.rb",
|
98
|
+
"spec/analytical/modules/google_spec.rb",
|
99
|
+
"spec/analytical/modules/kiss_metrics_spec.rb",
|
100
|
+
"spec/analytical/modules/optimizely_spec.rb",
|
101
101
|
"spec/analytical_spec.rb",
|
102
102
|
"spec/config/analytical.yml",
|
103
103
|
"spec/spec.opts",
|
@@ -106,18 +106,18 @@ Gem::Specification.new do |s|
|
|
106
106
|
s.homepage = %q{http://github.com/jkrall/analytical}
|
107
107
|
s.rdoc_options = ["--charset=UTF-8"]
|
108
108
|
s.require_paths = ["lib"]
|
109
|
-
s.rubygems_version = %q{1.3.
|
109
|
+
s.rubygems_version = %q{1.3.6}
|
110
110
|
s.summary = %q{Gem for managing multiple analytics services in your rails app.}
|
111
111
|
s.test_files = [
|
112
112
|
"spec/analytical/api_spec.rb",
|
113
|
-
"spec/analytical/base_spec.rb",
|
114
113
|
"spec/analytical/bot_detector_spec.rb",
|
115
|
-
"spec/analytical/
|
116
|
-
"spec/analytical/
|
117
|
-
"spec/analytical/
|
118
|
-
"spec/analytical/
|
119
|
-
"spec/analytical/
|
120
|
-
"spec/analytical/
|
114
|
+
"spec/analytical/modules/base_spec.rb",
|
115
|
+
"spec/analytical/modules/chartbeat_spec.rb",
|
116
|
+
"spec/analytical/modules/clicky_spec.rb",
|
117
|
+
"spec/analytical/modules/comscore_spec.rb",
|
118
|
+
"spec/analytical/modules/google_spec.rb",
|
119
|
+
"spec/analytical/modules/kiss_metrics_spec.rb",
|
120
|
+
"spec/analytical/modules/optimizely_spec.rb",
|
121
121
|
"spec/analytical_spec.rb",
|
122
122
|
"spec/spec_helper.rb"
|
123
123
|
]
|
@@ -126,7 +126,7 @@ Gem::Specification.new do |s|
|
|
126
126
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
127
127
|
s.specification_version = 3
|
128
128
|
|
129
|
-
if Gem::Version.new(Gem::
|
129
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
130
130
|
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
131
131
|
s.add_runtime_dependency(%q<activesupport>, [">= 0"])
|
132
132
|
else
|
data/lib/analytical.rb
CHANGED
data/lib/analytical/api.rb
CHANGED
@@ -6,8 +6,8 @@ module Analytical
|
|
6
6
|
def initialize(options={})
|
7
7
|
@options = options
|
8
8
|
@modules = @options[:modules].inject(ActiveSupport::OrderedHash.new) do |h, m|
|
9
|
-
module_options = @options.merge(@options[m] || {})
|
10
|
-
h[m] = "Analytical::#{m.to_s.camelize}
|
9
|
+
module_options = @options.merge(@options[m] || {})
|
10
|
+
h[m] = "Analytical::Modules::#{m.to_s.camelize}".constantize.new(module_options)
|
11
11
|
h
|
12
12
|
end
|
13
13
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Analytical
|
2
|
-
module
|
3
|
-
class
|
4
|
-
include Analytical::Base
|
2
|
+
module Modules
|
3
|
+
class Adwords
|
4
|
+
include Analytical::Modules::Base
|
5
5
|
|
6
6
|
def initialize(options={})
|
7
7
|
super
|
@@ -62,10 +62,10 @@ module Analytical
|
|
62
62
|
var google_conversion_value = #{data[:value] || conversion[:value]};
|
63
63
|
/* ]]> */
|
64
64
|
</script>
|
65
|
-
<script type="text/javascript" src="
|
65
|
+
<script type="text/javascript" src="#{procotol}://www.googleadservices.com/pagead/conversion.js"></script>
|
66
66
|
<noscript>
|
67
67
|
<div style="display:inline;">
|
68
|
-
<img height="1" width="1" style="border-style:none;" alt="" src="
|
68
|
+
<img height="1" width="1" style="border-style:none;" alt="" src="#{procotol}://www.googleadservices.com/pagead/conversion/#{conversion[:id]}/?label=#{conversion[:label]}&guid=ON&script=0"/>
|
69
69
|
</div>
|
70
70
|
</noscript>
|
71
71
|
HTML
|
@@ -1,17 +1,20 @@
|
|
1
1
|
module Analytical
|
2
|
-
module
|
3
|
-
module
|
4
|
-
attr_reader :tracking_command_location, :
|
2
|
+
module Modules
|
3
|
+
module Base
|
4
|
+
attr_reader :tracking_command_location, :options, :initialized
|
5
5
|
attr_accessor :commands
|
6
6
|
|
7
7
|
def initialize(_options={})
|
8
8
|
@options = _options
|
9
|
-
@parent = @options[:parent]
|
10
9
|
@tracking_command_location = :body_prepend
|
11
10
|
@initialized = false
|
12
11
|
@commands = []
|
13
12
|
end
|
14
13
|
|
14
|
+
def protocol
|
15
|
+
@options[:ssl] ? 'https' : 'http'
|
16
|
+
end
|
17
|
+
|
15
18
|
#
|
16
19
|
# The core methods that most analytics services implement are listed below.
|
17
20
|
# Modules will ignore any calls that they don't respond to, allowing them to
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Analytical
|
2
|
-
module
|
3
|
-
class
|
4
|
-
include Analytical::Base
|
2
|
+
module Modules
|
3
|
+
class Clicky
|
4
|
+
include Analytical::Modules::Base
|
5
5
|
|
6
6
|
def initialize(options={})
|
7
7
|
super
|
@@ -10,8 +10,6 @@ module Analytical
|
|
10
10
|
|
11
11
|
def init_javascript(location)
|
12
12
|
init_location(location) do
|
13
|
-
protocol = options[:ssl] ? 'https' : 'http'
|
14
|
-
|
15
13
|
js = <<-HTML
|
16
14
|
<!-- Analytical Init: Clicky -->
|
17
15
|
<script src="#{protocol}://static.getclicky.com/js" type="text/javascript"></script>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Analytical
|
2
|
-
module
|
3
|
-
class
|
4
|
-
include Analytical::Base
|
2
|
+
module Modules
|
3
|
+
class CrazyEgg
|
4
|
+
include Analytical::Modules::Base
|
5
5
|
|
6
6
|
def initialize(options={})
|
7
7
|
super
|
@@ -11,7 +11,6 @@ module Analytical
|
|
11
11
|
def init_javascript(location)
|
12
12
|
init_location(location) do
|
13
13
|
code_url = "#{options[:key][0,4]}/#{options[:key][4,4]}"
|
14
|
-
protocol = options[:ssl] ? 'https' : 'http'
|
15
14
|
js = <<-HTML
|
16
15
|
<!-- Analytical Init: CrazyEgg -->
|
17
16
|
<script type="text/javascript" src="#{protocol}://s3.amazonaws.com/new.cetrk.com/pages/scripts/#{code_url}.js"> </script>
|
data/spec/analytical/api_spec.rb
CHANGED
@@ -4,8 +4,8 @@ describe "Analytical::Api" do
|
|
4
4
|
|
5
5
|
describe 'on initialization' do
|
6
6
|
it 'should construct an api class for each module' do
|
7
|
-
Analytical::Console
|
8
|
-
Analytical::Google
|
7
|
+
Analytical::Modules::Console.should_receive(:new).and_return(@console = mock('console'))
|
8
|
+
Analytical::Modules::Google.should_receive(:new).and_return(@google = mock('google'))
|
9
9
|
a = Analytical::Api.new :modules=>[:console, :google]
|
10
10
|
a.modules.should == {
|
11
11
|
:console=>@console,
|
@@ -13,17 +13,17 @@ describe "Analytical::Api" do
|
|
13
13
|
}
|
14
14
|
end
|
15
15
|
it 'should pass the ssl option on to the module constructor' do
|
16
|
-
Analytical::Console
|
16
|
+
Analytical::Modules::Console.should_receive(:new).with(hash_including(:ssl=>true)).and_return(@console = mock('console'))
|
17
17
|
Analytical::Api.new :modules=>[:console], :ssl=>true
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
describe 'with modules' do
|
22
22
|
before(:each) do
|
23
|
-
Analytical::Console
|
24
|
-
Analytical::Google
|
25
|
-
Analytical::Clicky
|
26
|
-
Analytical::Chartbeat
|
23
|
+
Analytical::Modules::Console.stub!(:new).and_return(@console = mock('console'))
|
24
|
+
Analytical::Modules::Google.stub!(:new).and_return(@google = mock('google'))
|
25
|
+
Analytical::Modules::Clicky.stub!(:new).and_return(@clicky = mock('clicky'))
|
26
|
+
Analytical::Modules::Chartbeat.stub!(:new).and_return(@chartbeat = mock('chartbeat'))
|
27
27
|
|
28
28
|
@api = Analytical::Api.new :modules=>[:console, :google]
|
29
29
|
end
|
@@ -1,9 +1,24 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
2
|
|
3
|
-
describe Analytical::Base
|
3
|
+
describe Analytical::Modules::Base do
|
4
4
|
|
5
5
|
class BaseApiDummy
|
6
|
-
include Analytical::Base
|
6
|
+
include Analytical::Modules::Base
|
7
|
+
end
|
8
|
+
|
9
|
+
describe '#protocol' do
|
10
|
+
before(:each) do
|
11
|
+
@api = BaseApiDummy.new(:parent=>mock('parent'))
|
12
|
+
end
|
13
|
+
describe 'with :ssl=>true option' do
|
14
|
+
it 'should return https' do
|
15
|
+
@api = BaseApiDummy.new(:parent=>mock('parent'), :ssl=>true)
|
16
|
+
@api.protocol.should == 'https'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
it 'should return http' do
|
20
|
+
@api.protocol.should == 'http'
|
21
|
+
end
|
7
22
|
end
|
8
23
|
|
9
24
|
describe '#queue' do
|
@@ -1,22 +1,22 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
2
|
|
3
|
-
describe "Analytical::Chartbeat
|
3
|
+
describe "Analytical::Modules::Chartbeat" do
|
4
4
|
before(:each) do
|
5
5
|
@parent = mock('api', :options=>{:chartbeat=>{:key=>1234, :domain =>'test.com'}})
|
6
6
|
end
|
7
7
|
describe 'on initialize' do
|
8
8
|
it 'should set the command_location' do
|
9
|
-
a = Analytical::Chartbeat
|
9
|
+
a = Analytical::Modules::Chartbeat.new :parent=>@parent, :key=>1234
|
10
10
|
a.tracking_command_location.should == [:head_prepend, :body_append]
|
11
11
|
end
|
12
12
|
it 'should set the options' do
|
13
|
-
a = Analytical::Chartbeat
|
13
|
+
a = Analytical::Modules::Chartbeat.new :parent=>@parent, :key=>12345, :domain =>'abcdef.com'
|
14
14
|
a.options.should == {:key=>12345, :domain => 'abcdef.com', :parent=>@parent}
|
15
15
|
end
|
16
16
|
end
|
17
17
|
describe '#init_javascript' do
|
18
18
|
it 'should return the init javascript' do
|
19
|
-
@api = Analytical::Chartbeat
|
19
|
+
@api = Analytical::Modules::Chartbeat.new :parent=>@parent, :key=>12345, :domain =>'abcdef.com'
|
20
20
|
@api.init_javascript(:head_prepend).should =~ /_sf_startpt=\(new.Date\(\)\)\.getTime\(\);/
|
21
21
|
@api.init_javascript(:head_append).should == ''
|
22
22
|
@api.init_javascript(:body_prepend).should == ''
|
@@ -1,34 +1,34 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
2
|
|
3
|
-
describe "Analytical::Clicky
|
3
|
+
describe "Analytical::Modules::Clicky" do
|
4
4
|
before(:each) do
|
5
5
|
@parent = mock('api', :options=>{:google=>{:key=>'abc'}})
|
6
6
|
end
|
7
7
|
describe 'on initialize' do
|
8
8
|
it 'should set the command_location' do
|
9
|
-
a = Analytical::Clicky
|
9
|
+
a = Analytical::Modules::Clicky.new :parent=>@parent, :key=>'abc'
|
10
10
|
a.tracking_command_location.should == :body_append
|
11
11
|
end
|
12
12
|
it 'should set the options' do
|
13
|
-
a = Analytical::Clicky
|
13
|
+
a = Analytical::Modules::Clicky.new :parent=>@parent, :key=>'abc'
|
14
14
|
a.options.should == {:key=>'abc', :parent=>@parent}
|
15
15
|
end
|
16
16
|
end
|
17
17
|
describe '#track' do
|
18
18
|
it 'should return the tracking javascript' do
|
19
|
-
@api = Analytical::Clicky
|
19
|
+
@api = Analytical::Modules::Clicky.new :parent=>@parent, :key=>'abcdef'
|
20
20
|
@api.track('pagename', {:some=>'data'}).should == "clicky.log(\"pagename\");"
|
21
21
|
end
|
22
22
|
end
|
23
23
|
describe '#identify' do
|
24
24
|
it 'should return the init code string' do
|
25
|
-
@api = Analytical::Clicky
|
25
|
+
@api = Analytical::Modules::Clicky.new :parent=>@parent, :key=>'abcdef'
|
26
26
|
@api.identify('user id', {:a=>'b'}).should =~ /#{Regexp.escape({:id=>'user id', :a=>'b'}.to_json)}/
|
27
27
|
end
|
28
28
|
end
|
29
29
|
describe '#init_javascript' do
|
30
30
|
it 'should return the init javascript' do
|
31
|
-
@api = Analytical::Clicky
|
31
|
+
@api = Analytical::Modules::Clicky.new :parent=>@parent, :key=>'abcdef'
|
32
32
|
@api.init_javascript(:head_prepend).should == ''
|
33
33
|
@api.init_javascript(:head_append).should == ''
|
34
34
|
@api.init_javascript(:body_prepend).should == ''
|
@@ -37,12 +37,12 @@ describe "Analytical::Clicky::Api" do
|
|
37
37
|
end
|
38
38
|
describe 'for an ssl connection' do
|
39
39
|
it 'should return the ssl init code' do
|
40
|
-
@api = Analytical::Clicky
|
40
|
+
@api = Analytical::Modules::Clicky.new :parent=>@parent, :key=>'abcdef', :ssl=>true
|
41
41
|
@api.init_javascript(:body_append).should =~ /https/
|
42
42
|
end
|
43
43
|
end
|
44
44
|
describe 'with an identify command queued' do
|
45
|
-
@api = Analytical::Clicky
|
45
|
+
@api = Analytical::Modules::Clicky.new :parent=>@parent, :key=>'abcdef'
|
46
46
|
@api.queue :identify, 'user id', {:email=>'someone@test.com'}
|
47
47
|
@api.init_javascript(:body_append).should =~ /"email":\w*"someone@test\.com"/
|
48
48
|
end
|
@@ -1,22 +1,22 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
2
|
|
3
|
-
describe "Analytical::Comscore
|
3
|
+
describe "Analytical::Modules::Comscore" do
|
4
4
|
before(:each) do
|
5
5
|
@parent = mock('api', :options=>{:comscore=>{:key=>123}})
|
6
6
|
end
|
7
7
|
describe 'on initialize' do
|
8
8
|
it 'should set the command_location' do
|
9
|
-
a = Analytical::Comscore
|
9
|
+
a = Analytical::Modules::Comscore.new :parent=>@parent, :key=>123
|
10
10
|
a.tracking_command_location.should == :head_append
|
11
11
|
end
|
12
12
|
it 'should set the options' do
|
13
|
-
a = Analytical::Comscore
|
13
|
+
a = Analytical::Modules::Comscore.new :parent=>@parent, :key=>1234
|
14
14
|
a.options.should == {:key=>1234, :parent=>@parent}
|
15
15
|
end
|
16
16
|
end
|
17
17
|
describe '#init_javascript' do
|
18
18
|
it 'should return the init javascript' do
|
19
|
-
@api = Analytical::Comscore
|
19
|
+
@api = Analytical::Modules::Comscore.new :parent=>@parent, :key=>1234
|
20
20
|
@api.init_javascript(:head_prepend).should == ''
|
21
21
|
@api.init_javascript(:head_append).should =~ /scorecardresearch.com\/beacon.js/
|
22
22
|
@api.init_javascript(:head_append).should =~ /1234/
|
@@ -1,29 +1,29 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
2
|
|
3
|
-
describe "Analytical::Google
|
3
|
+
describe "Analytical::Modules::Google" do
|
4
4
|
before(:each) do
|
5
5
|
@parent = mock('api', :options=>{:google=>{:key=>'abc'}})
|
6
6
|
end
|
7
7
|
describe 'on initialize' do
|
8
8
|
it 'should set the command_location' do
|
9
|
-
a = Analytical::Google
|
9
|
+
a = Analytical::Modules::Google.new :parent=>@parent, :key=>'abc'
|
10
10
|
a.tracking_command_location.should == :head_append
|
11
11
|
end
|
12
12
|
it 'should set the options' do
|
13
|
-
a = Analytical::Google
|
13
|
+
a = Analytical::Modules::Google.new :parent=>@parent, :key=>'abc'
|
14
14
|
a.options.should == {:key=>'abc', :parent=>@parent}
|
15
15
|
end
|
16
16
|
end
|
17
17
|
describe '#track' do
|
18
18
|
it 'should return the tracking javascript' do
|
19
|
-
@api = Analytical::Google
|
19
|
+
@api = Analytical::Modules::Google.new :parent=>@parent, :key=>'abcdef'
|
20
20
|
@api.track.should == "_gaq.push(['_trackPageview']);"
|
21
21
|
@api.track('pagename', {:some=>'data'}).should == "_gaq.push(['_trackPageview', \"pagename\"]);"
|
22
22
|
end
|
23
23
|
end
|
24
24
|
describe '#init_javascript' do
|
25
25
|
it 'should return the init javascript' do
|
26
|
-
@api = Analytical::Google
|
26
|
+
@api = Analytical::Modules::Google.new :parent=>@parent, :key=>'abcdef'
|
27
27
|
@api.init_javascript(:head_prepend).should == ''
|
28
28
|
@api.init_javascript(:head_append).should =~ /abcdef/
|
29
29
|
@api.init_javascript(:head_append).should =~ /google-analytics.com\/ga.js/
|
@@ -1,46 +1,46 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
2
|
|
3
|
-
describe "Analytical::KissMetrics
|
3
|
+
describe "Analytical::Modules::KissMetrics" do
|
4
4
|
before(:each) do
|
5
5
|
@parent = mock('api', :options=>{:google=>{:js_url_key=>'abc'}})
|
6
6
|
end
|
7
7
|
describe 'on initialize' do
|
8
8
|
it 'should set the command_location' do
|
9
|
-
a = Analytical::KissMetrics
|
9
|
+
a = Analytical::Modules::KissMetrics.new :parent=>@parent, :js_url_key=>'abc'
|
10
10
|
a.tracking_command_location.should == :body_prepend
|
11
11
|
end
|
12
12
|
it 'should set the options' do
|
13
|
-
a = Analytical::KissMetrics
|
13
|
+
a = Analytical::Modules::KissMetrics.new :parent=>@parent, :js_url_key=>'abc'
|
14
14
|
a.options.should == {:js_url_key=>'abc', :parent=>@parent}
|
15
15
|
end
|
16
16
|
end
|
17
17
|
describe '#identify' do
|
18
18
|
it 'should return a js string' do
|
19
|
-
@api = Analytical::KissMetrics
|
19
|
+
@api = Analytical::Modules::KissMetrics.new :parent=>@parent, :js_url_key=>'abcdef'
|
20
20
|
@api.identify('id', {:email=>'test@test.com'}).should == "_kmq.push([\"identify\", \"test@test.com\"]);"
|
21
21
|
end
|
22
22
|
end
|
23
23
|
describe '#event' do
|
24
24
|
it 'should return a js string' do
|
25
|
-
@api = Analytical::KissMetrics
|
25
|
+
@api = Analytical::Modules::KissMetrics.new :parent=>@parent, :js_url_key=>'abcdef'
|
26
26
|
@api.event('Big Deal', {:something=>'good'}).should == "_kmq.push([\"record\", \"Big Deal\", #{{:something=>'good'}.to_json}]);"
|
27
27
|
end
|
28
28
|
end
|
29
29
|
describe '#set' do
|
30
30
|
it 'should return a js string' do
|
31
|
-
@api = Analytical::KissMetrics
|
31
|
+
@api = Analytical::Modules::KissMetrics.new :parent=>@parent, :js_url_key=>'abcdef'
|
32
32
|
@api.set({:something=>'good', :b=>2}).should == "_kmq.push([\"set\", #{{:something=>'good', :b=>2}.to_json}]);"
|
33
33
|
end
|
34
34
|
end
|
35
35
|
describe '#alias_identity' do
|
36
36
|
it 'should return a js string' do
|
37
|
-
@api = Analytical::KissMetrics
|
37
|
+
@api = Analytical::Modules::KissMetrics.new :parent=>@parent, :js_url_key=>'abcdef'
|
38
38
|
@api.alias_identity('foo', 'bar').should == "_kmq.push([\"alias\", \"foo\", \"bar\"]);"
|
39
39
|
end
|
40
40
|
end
|
41
41
|
describe '#init_javascript' do
|
42
42
|
it 'should return the init javascript' do
|
43
|
-
@api = Analytical::KissMetrics
|
43
|
+
@api = Analytical::Modules::KissMetrics.new :parent=>@parent, :js_url_key=>'abcdef'
|
44
44
|
@api.init_javascript(:head_prepend).should == ''
|
45
45
|
@api.init_javascript(:head_append).should == ''
|
46
46
|
@api.init_javascript(:body_prepend).should =~ /i\.kissmetrics\.com/
|
@@ -1,22 +1,22 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
2
|
|
3
|
-
describe "Analytical::Optimizely
|
3
|
+
describe "Analytical::Modules::Optimizely" do
|
4
4
|
before(:each) do
|
5
5
|
@parent = mock('api', :options=>{:optimizely=>{:key=>'abc'}})
|
6
6
|
end
|
7
7
|
describe 'on initialize' do
|
8
8
|
it 'should set the command_location' do
|
9
|
-
a = Analytical::Optimizely
|
9
|
+
a = Analytical::Modules::Optimizely.new :parent=>@parent, :key=>'abc'
|
10
10
|
a.tracking_command_location.should == :head_prepend
|
11
11
|
end
|
12
12
|
it 'should set the options' do
|
13
|
-
a = Analytical::Optimizely
|
13
|
+
a = Analytical::Modules::Optimizely.new :parent=>@parent, :key=>'abc'
|
14
14
|
a.options.should == {:key=>'abc', :parent=>@parent}
|
15
15
|
end
|
16
16
|
end
|
17
17
|
describe '#init_javascript' do
|
18
18
|
it 'should return the init javascript' do
|
19
|
-
@api = Analytical::Optimizely
|
19
|
+
@api = Analytical::Modules::Optimizely.new :parent=>@parent, :key=>'abcdef'
|
20
20
|
@api.init_javascript(:head_prepend).should =~ /cdn\.optimizely.com\/js\/abcdef\.js/
|
21
21
|
@api.init_javascript(:head_append).should == ''
|
22
22
|
@api.init_javascript(:body_prepend).should == ''
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: analytical
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 55
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 1
|
8
|
-
-
|
7
|
+
- 9
|
9
8
|
- 0
|
10
|
-
version: 1.
|
9
|
+
version: 1.9.0
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Joshua Krall
|
@@ -17,18 +16,16 @@ autorequire:
|
|
17
16
|
bindir: bin
|
18
17
|
cert_chain: []
|
19
18
|
|
20
|
-
date: 2010-09-
|
19
|
+
date: 2010-09-29 00:00:00 -05:00
|
21
20
|
default_executable:
|
22
21
|
dependencies:
|
23
22
|
- !ruby/object:Gem::Dependency
|
24
23
|
name: rspec
|
25
24
|
prerelease: false
|
26
25
|
requirement: &id001 !ruby/object:Gem::Requirement
|
27
|
-
none: false
|
28
26
|
requirements:
|
29
27
|
- - ">="
|
30
28
|
- !ruby/object:Gem::Version
|
31
|
-
hash: 13
|
32
29
|
segments:
|
33
30
|
- 1
|
34
31
|
- 2
|
@@ -40,11 +37,9 @@ dependencies:
|
|
40
37
|
name: activesupport
|
41
38
|
prerelease: false
|
42
39
|
requirement: &id002 !ruby/object:Gem::Requirement
|
43
|
-
none: false
|
44
40
|
requirements:
|
45
41
|
- - ">="
|
46
42
|
- !ruby/object:Gem::Version
|
47
|
-
hash: 3
|
48
43
|
segments:
|
49
44
|
- 0
|
50
45
|
version: "0"
|
@@ -118,29 +113,29 @@ files:
|
|
118
113
|
- example/test/unit/helpers/page_helper_test.rb
|
119
114
|
- example/vendor/plugins/.gitkeep
|
120
115
|
- lib/analytical.rb
|
121
|
-
- lib/analytical/adwords.rb
|
122
116
|
- lib/analytical/api.rb
|
123
|
-
- lib/analytical/base.rb
|
124
117
|
- lib/analytical/bot_detector.rb
|
125
|
-
- lib/analytical/
|
126
|
-
- lib/analytical/
|
127
|
-
- lib/analytical/
|
128
|
-
- lib/analytical/
|
129
|
-
- lib/analytical/
|
130
|
-
- lib/analytical/
|
131
|
-
- lib/analytical/
|
132
|
-
- lib/analytical/
|
133
|
-
- lib/analytical/
|
118
|
+
- lib/analytical/modules/adwords.rb
|
119
|
+
- lib/analytical/modules/base.rb
|
120
|
+
- lib/analytical/modules/chartbeat.rb
|
121
|
+
- lib/analytical/modules/clicky.rb
|
122
|
+
- lib/analytical/modules/comscore.rb
|
123
|
+
- lib/analytical/modules/console.rb
|
124
|
+
- lib/analytical/modules/crazy_egg.rb
|
125
|
+
- lib/analytical/modules/google.rb
|
126
|
+
- lib/analytical/modules/hubspot.rb
|
127
|
+
- lib/analytical/modules/kiss_metrics.rb
|
128
|
+
- lib/analytical/modules/optimizely.rb
|
134
129
|
- rails/init.rb
|
135
130
|
- spec/analytical/api_spec.rb
|
136
|
-
- spec/analytical/base_spec.rb
|
137
131
|
- spec/analytical/bot_detector_spec.rb
|
138
|
-
- spec/analytical/
|
139
|
-
- spec/analytical/
|
140
|
-
- spec/analytical/
|
141
|
-
- spec/analytical/
|
142
|
-
- spec/analytical/
|
143
|
-
- spec/analytical/
|
132
|
+
- spec/analytical/modules/base_spec.rb
|
133
|
+
- spec/analytical/modules/chartbeat_spec.rb
|
134
|
+
- spec/analytical/modules/clicky_spec.rb
|
135
|
+
- spec/analytical/modules/comscore_spec.rb
|
136
|
+
- spec/analytical/modules/google_spec.rb
|
137
|
+
- spec/analytical/modules/kiss_metrics_spec.rb
|
138
|
+
- spec/analytical/modules/optimizely_spec.rb
|
144
139
|
- spec/analytical_spec.rb
|
145
140
|
- spec/config/analytical.yml
|
146
141
|
- spec/spec.opts
|
@@ -155,39 +150,35 @@ rdoc_options:
|
|
155
150
|
require_paths:
|
156
151
|
- lib
|
157
152
|
required_ruby_version: !ruby/object:Gem::Requirement
|
158
|
-
none: false
|
159
153
|
requirements:
|
160
154
|
- - ">="
|
161
155
|
- !ruby/object:Gem::Version
|
162
|
-
hash: 3
|
163
156
|
segments:
|
164
157
|
- 0
|
165
158
|
version: "0"
|
166
159
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
|
-
none: false
|
168
160
|
requirements:
|
169
161
|
- - ">="
|
170
162
|
- !ruby/object:Gem::Version
|
171
|
-
hash: 3
|
172
163
|
segments:
|
173
164
|
- 0
|
174
165
|
version: "0"
|
175
166
|
requirements: []
|
176
167
|
|
177
168
|
rubyforge_project:
|
178
|
-
rubygems_version: 1.3.
|
169
|
+
rubygems_version: 1.3.6
|
179
170
|
signing_key:
|
180
171
|
specification_version: 3
|
181
172
|
summary: Gem for managing multiple analytics services in your rails app.
|
182
173
|
test_files:
|
183
174
|
- spec/analytical/api_spec.rb
|
184
|
-
- spec/analytical/base_spec.rb
|
185
175
|
- spec/analytical/bot_detector_spec.rb
|
186
|
-
- spec/analytical/
|
187
|
-
- spec/analytical/
|
188
|
-
- spec/analytical/
|
189
|
-
- spec/analytical/
|
190
|
-
- spec/analytical/
|
191
|
-
- spec/analytical/
|
176
|
+
- spec/analytical/modules/base_spec.rb
|
177
|
+
- spec/analytical/modules/chartbeat_spec.rb
|
178
|
+
- spec/analytical/modules/clicky_spec.rb
|
179
|
+
- spec/analytical/modules/comscore_spec.rb
|
180
|
+
- spec/analytical/modules/google_spec.rb
|
181
|
+
- spec/analytical/modules/kiss_metrics_spec.rb
|
182
|
+
- spec/analytical/modules/optimizely_spec.rb
|
192
183
|
- spec/analytical_spec.rb
|
193
184
|
- spec/spec_helper.rb
|