analytical 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.0
1
+ 1.3.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{analytical}
8
- s.version = "1.2.0"
8
+ s.version = "1.3.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-26}
12
+ s.date = %q{2010-07-23}
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 = [
@@ -3,7 +3,7 @@ google:
3
3
  clicky:
4
4
  key: clicky_12345
5
5
  kiss_metrics:
6
- key: kiss_metrics_12345
6
+ js_url_key: //doug1izaerwt3.cloudfront.net/kiss_metrics_12345.1.js
7
7
  adwords:
8
8
  'Some Event':
9
9
  id: 4444555555
@@ -13,7 +13,9 @@ module Analytical
13
13
  js = <<-HTML
14
14
  <!-- Analytical Init: Console -->
15
15
  <script type="text/javascript">
16
- console.log('Analytical Init: Console');
16
+ if(typeof(console) !== 'undefined' && console != null) {
17
+ console.log('Analytical Init: Console');
18
+ }
17
19
  </script>
18
20
  HTML
19
21
  js
@@ -21,21 +23,21 @@ module Analytical
21
23
  end
22
24
 
23
25
  def track(*args)
24
- "console.log(\"Analytical Track: \"+\"#{escape args.first}\");"
26
+ check_for_console "console.log(\"Analytical Track: \"+\"#{escape args.first}\");"
25
27
  end
26
28
 
27
29
  def identify(id, *args)
28
30
  data = args.first || {}
29
- "console.log(\"Analytical Identify: \"+\"#{id}\"+\" \"+$H(#{data.to_json}).toJSON());"
31
+ check_for_console "console.log(\"Analytical Identify: \"+\"#{id}\"+\" \"+$H(#{data.to_json}).toJSON());"
30
32
  end
31
33
 
32
34
  def event(name, *args)
33
35
  data = args.first || {}
34
- "console.log(\"Analytical Event: \"+\"#{name}\"+\" \"+$H(#{data.to_json}).toJSON());"
36
+ check_for_console "console.log(\"Analytical Event: \"+\"#{name}\"+\" \"+$H(#{data.to_json}).toJSON());"
35
37
  end
36
38
 
37
39
  def set(data)
38
- "console.log(\"Analytical Set: \"+$H(#{data.to_json}).toJSON());"
40
+ check_for_console "console.log(\"Analytical Set: \"+$H(#{data.to_json}).toJSON());"
39
41
  end
40
42
 
41
43
  private
@@ -54,6 +56,10 @@ module Analytical
54
56
  js.gsub(/(\\|<\/|\r\n|[\n\r"'])/) { CONSOLE_JS_ESCAPE_MAP[$1] }
55
57
  end
56
58
 
59
+ def check_for_console(data)
60
+ "if(typeof(console) !== 'undefined' && console != null) { #{data} }"
61
+ end
62
+
57
63
  end
58
64
  end
59
- end
65
+ end
@@ -14,7 +14,13 @@ module Analytical
14
14
  <!-- Analytical Init: KissMetrics -->
15
15
  <script type="text/javascript">
16
16
  var _kmq = _kmq || [];
17
- (function(){function _kms(u,d){if(navigator.appName.indexOf("Microsoft")==0 && d)document.write("<scr"+"ipt defer='defer' async='true' src='"+u+"'></scr"+"ipt>");else{var s=document.createElement('script');s.type='text/javascript';s.async=true;s.src=u;(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(s);}}_kms('http' + ('https:' == document.location.protocol ? 's://': '://') + 'i.kissmetrics.com/i.js', 1);_kms('http'+('https:'==document.location.protocol ? 's://s3.amazonaws.com/' : '://')+'scripts.kissmetrics.com/#{options[:key]}.1.js',1);})();
17
+ function _kms(u){
18
+ setTimeout(function(){
19
+ var s = document.createElement('script'); var f = document.getElementsByTagName('script')[0]; s.type = 'text/javascript'; s.async = true;
20
+ s.src = u; f.parentNode.insertBefore(s, f);
21
+ }, 1);
22
+ }
23
+ _kms('//i.kissmetrics.com/i.js');_kms('#{options[:js_url_key]}');
18
24
  </script>
19
25
  <script type="text/javascript">
20
26
  _kmq.push(['pageView']);
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: 31
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
- - 2
8
+ - 3
9
9
  - 0
10
- version: 1.2.0
10
+ version: 1.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joshua Krall
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-06-26 00:00:00 -05:00
18
+ date: 2010-07-23 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency