analytical 2.3.0 → 2.4.0

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/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.4.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{analytical}
8
- s.version = "2.3.0"
8
+ s.version = "2.4.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{2011-01-12}
12
+ s.date = %q{2011-01-24}
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 = [
@@ -89,6 +89,7 @@ Gem::Specification.new do |s|
89
89
  "lib/analytical/modules/google.rb",
90
90
  "lib/analytical/modules/hubspot.rb",
91
91
  "lib/analytical/modules/kiss_metrics.rb",
92
+ "lib/analytical/modules/microsoft_ads.rb",
92
93
  "lib/analytical/modules/mixpanel.rb",
93
94
  "lib/analytical/modules/optimizely.rb",
94
95
  "lib/analytical/session_command_store.rb",
@@ -114,7 +115,7 @@ Gem::Specification.new do |s|
114
115
  s.homepage = %q{http://github.com/jkrall/analytical}
115
116
  s.rdoc_options = ["--charset=UTF-8"]
116
117
  s.require_paths = ["lib"]
117
- s.rubygems_version = %q{1.3.6}
118
+ s.rubygems_version = %q{1.3.7}
118
119
  s.summary = %q{Gem for managing multiple analytics services in your rails app.}
119
120
  s.test_files = [
120
121
  "spec/analytical/api_spec.rb",
@@ -138,7 +139,7 @@ Gem::Specification.new do |s|
138
139
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
139
140
  s.specification_version = 3
140
141
 
141
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
142
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
142
143
  s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
143
144
  s.add_runtime_dependency(%q<activesupport>, [">= 0"])
144
145
  else
@@ -1,9 +1,8 @@
1
1
  PATH
2
- remote: /Users/krall/Programming/analytical
2
+ remote: ..
3
3
  specs:
4
- analytical (1.8.0)
4
+ analytical (2.3.0)
5
5
  activesupport
6
- json
7
6
 
8
7
  GEM
9
8
  remote: http://rubygems.org/
@@ -41,7 +40,6 @@ GEM
41
40
  erubis (2.6.6)
42
41
  abstract (>= 1.0.0)
43
42
  i18n (0.4.1)
44
- json (1.4.6)
45
43
  mail (2.2.5)
46
44
  activesupport (>= 2.3.6)
47
45
  mime-types
@@ -2,5 +2,5 @@ class ApplicationController < ActionController::Base
2
2
  protect_from_forgery
3
3
  layout 'application'
4
4
 
5
- analytical :modules=>[:console, :google, :clicky], :disable_if=>lambda{false}, :use_session_store=>true
5
+ analytical :modules=>[:console, :google, :clicky], :disable_if=>lambda{|controller| false}, :use_session_store=>true
6
6
  end
@@ -42,6 +42,7 @@ module Analytical
42
42
  # def init_javascript(location)
43
43
 
44
44
  def queue(*args)
45
+ return if @options[:ignore_duplicates] && @command_store.include?(args)
45
46
  if args.first==:identify
46
47
  @command_store.unshift args
47
48
  else
@@ -0,0 +1,58 @@
1
+ module Analytical
2
+ module Modules
3
+ class Adwords
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
+ @initializing = true
14
+ html = "<!-- Analytical Init: Microsoft Ads -->\n"
15
+ event_commands = []
16
+ @command_store.commands.each do |c|
17
+ if c[0] == :event
18
+ event_commands << event(*c[1..-1])
19
+ end
20
+ end
21
+ html += event_commands.join("\n")
22
+ @command_store.commands = @command_store.commands.delete_if {|c| c[0] == :event }
23
+ @initializing = false
24
+
25
+ html
26
+ end
27
+ end
28
+
29
+ #
30
+ # Define conversion events in analytical.yml like:
31
+ #
32
+ # microsoft_ads:
33
+ # 'Some Event':
34
+ # id: 55555555-6666-7777-8888-111111111111
35
+ def event(name, *args)
36
+ return '' unless @initializing
37
+
38
+ data = args.first || {}
39
+ if conversion = options[name.to_sym]
40
+ conversion.symbolize_keys!
41
+ js = <<-HTML
42
+ <script type="text/javascript">if (!window.mstag) mstag = {loadTag : function(){},time : (new Date()).getTime()};</script>
43
+ <script id="mstag_tops" type="text/javascript" src="//flex.atdmt.com/mstag/site/#{conversion[:id]}/mstag.js"></script>
44
+ <script type="text/javascript"> mstag.loadTag("conversion", {cp:"5050",dedup:"1"})</script>
45
+ <noscript>
46
+ <iframe src="//flex.atdmt.com/mstag/tag/#{conversion[:id]}/conversion.html?cp=5050&dedup=1" frameborder="0" scrolling="no" width="1" height="1" style="visibility:hidden; display:none"></iframe>
47
+ </noscript>
48
+ HTML
49
+ js
50
+ else
51
+ "<!-- No Microsoft Ads Conversion for: #{name} -->"
52
+ end
53
+ end
54
+
55
+ end
56
+ end
57
+ end
58
+
@@ -38,6 +38,19 @@ describe Analytical::Modules::Base do
38
38
  @api.command_store.commands.should == [:a, :b, :c, [:other, {:some=>:args}]]
39
39
  end
40
40
  end
41
+ describe 'ignoring duplicates' do
42
+ before(:each) do
43
+ @api = BaseApiDummy.new(:parent=>mock('parent'), :ignore_duplicates=>true)
44
+ @api.command_store.commands = [[:a]]
45
+ end
46
+ it 'should store only unique commands' do
47
+ @api.queue :other, {:some=>:args}
48
+ @api.queue :a
49
+ @api.queue :other, {:some=>:args}
50
+ @api.queue :b
51
+ @api.command_store.commands.should == [[:a], [:other, {:some=>:args}], [:b]]
52
+ end
53
+ end
41
54
  end
42
55
 
43
56
  describe '#process_queued_commands' do
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: analytical
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 31
4
5
  prerelease: false
5
6
  segments:
6
7
  - 2
7
- - 3
8
+ - 4
8
9
  - 0
9
- version: 2.3.0
10
+ version: 2.4.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - Joshua Krall
@@ -16,16 +17,18 @@ autorequire:
16
17
  bindir: bin
17
18
  cert_chain: []
18
19
 
19
- date: 2011-01-12 00:00:00 -06:00
20
+ date: 2011-01-24 00:00:00 -06:00
20
21
  default_executable:
21
22
  dependencies:
22
23
  - !ruby/object:Gem::Dependency
23
24
  name: rspec
24
25
  prerelease: false
25
26
  requirement: &id001 !ruby/object:Gem::Requirement
27
+ none: false
26
28
  requirements:
27
29
  - - ">="
28
30
  - !ruby/object:Gem::Version
31
+ hash: 13
29
32
  segments:
30
33
  - 1
31
34
  - 2
@@ -37,9 +40,11 @@ dependencies:
37
40
  name: activesupport
38
41
  prerelease: false
39
42
  requirement: &id002 !ruby/object:Gem::Requirement
43
+ none: false
40
44
  requirements:
41
45
  - - ">="
42
46
  - !ruby/object:Gem::Version
47
+ hash: 3
43
48
  segments:
44
49
  - 0
45
50
  version: "0"
@@ -127,6 +132,7 @@ files:
127
132
  - lib/analytical/modules/google.rb
128
133
  - lib/analytical/modules/hubspot.rb
129
134
  - lib/analytical/modules/kiss_metrics.rb
135
+ - lib/analytical/modules/microsoft_ads.rb
130
136
  - lib/analytical/modules/mixpanel.rb
131
137
  - lib/analytical/modules/optimizely.rb
132
138
  - lib/analytical/session_command_store.rb
@@ -158,23 +164,27 @@ rdoc_options:
158
164
  require_paths:
159
165
  - lib
160
166
  required_ruby_version: !ruby/object:Gem::Requirement
167
+ none: false
161
168
  requirements:
162
169
  - - ">="
163
170
  - !ruby/object:Gem::Version
171
+ hash: 3
164
172
  segments:
165
173
  - 0
166
174
  version: "0"
167
175
  required_rubygems_version: !ruby/object:Gem::Requirement
176
+ none: false
168
177
  requirements:
169
178
  - - ">="
170
179
  - !ruby/object:Gem::Version
180
+ hash: 3
171
181
  segments:
172
182
  - 0
173
183
  version: "0"
174
184
  requirements: []
175
185
 
176
186
  rubyforge_project:
177
- rubygems_version: 1.3.6
187
+ rubygems_version: 1.3.7
178
188
  signing_key:
179
189
  specification_version: 3
180
190
  summary: Gem for managing multiple analytics services in your rails app.