analytical 0.15.0 → 0.16.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
- 0.15.0
1
+ 0.16.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{analytical}
8
- s.version = "0.15.0"
8
+ s.version = "0.16.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"]
12
- s.date = %q{2010-06-16}
12
+ s.date = %q{2010-06-17}
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 = [
@@ -1,3 +1,4 @@
1
+ require File.dirname(__FILE__)+'/analytical/base'
1
2
  Dir.glob(File.dirname(__FILE__)+'/analytical/*.rb').each do |f|
2
3
  require f
3
4
  end
@@ -9,7 +9,21 @@ module Analytical
9
9
  end
10
10
 
11
11
  def init_javascript(location)
12
- return ''
12
+ return '' unless location==:body_append
13
+
14
+ @initializing = true
15
+ html = "<!-- Analytical Init: Google Adwords -->\n"
16
+ event_commands = []
17
+ @commands.each do |c|
18
+ if c[0] == :event
19
+ event_commands << event(*c[1..-1])
20
+ end
21
+ end
22
+ html += event_commands.join("\n")
23
+ @commands = @commands.delete_if {|c| c[0] == :event }
24
+ @initializing = false
25
+
26
+ html
13
27
  end
14
28
 
15
29
  #
@@ -32,11 +46,12 @@ module Analytical
32
46
  # value: 0
33
47
  #
34
48
  def event(name, *args)
49
+ return '' unless @initializing
50
+
35
51
  data = args.first || {}
36
- html = ''
37
- if conversion = options[name]
38
- html = <<-HTML
39
- <!-- Google Code for PPC Landing Page Conversion Page -->
52
+ if conversion = options[name.to_sym]
53
+ conversion.symbolize_keys!
54
+ js = <<-HTML
40
55
  <script type="text/javascript">
41
56
  /* <![CDATA[ */
42
57
  var google_conversion_id = #{conversion[:id]};
@@ -54,8 +69,10 @@ module Analytical
54
69
  </div>
55
70
  </noscript>
56
71
  HTML
72
+ js
73
+ else
74
+ "<!-- No Adwords Conversion for: #{name} -->"
57
75
  end
58
- html
59
76
  end
60
77
 
61
78
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 15
7
+ - 16
8
8
  - 0
9
- version: 0.15.0
9
+ version: 0.16.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Joshua Krall
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-16 00:00:00 -05:00
17
+ date: 2010-06-17 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency