analytics-rails 0.0.1 → 0.0.2

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/README.rdoc CHANGED
@@ -16,3 +16,5 @@ Then bundle:
16
16
 
17
17
  In your layout add a line like this in your head:
18
18
  = google_analytics_include_tag 'your-id'
19
+
20
+ (Will only show the include tag in production env)
@@ -2,17 +2,20 @@ module Analytics
2
2
  module Rails
3
3
  module Helpers
4
4
 
5
- def google_analytics_include_tag(id)
6
- content_tag(:script, :type => 'text/javascript') do
7
- "var _gaq = _gaq || [];
8
- _gaq.push(['_setAccount', '#{id}']);
9
- _gaq.push(['_trackPageview']);
10
- (function(){
11
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
12
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
13
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
14
- })();"
15
- end if id.present? and ::Rails.env.production?
5
+ def google_analytics_include_tag(account)
6
+ if ::Rails.env.production?
7
+ script = <<-SCRIPT
8
+ var _gaq = _gaq || [];
9
+ _gaq.push(['_setAccount', '#{account}']);
10
+ _gaq.push(['_trackPageview']);
11
+ (function(){
12
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
13
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
14
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
15
+ })();
16
+ SCRIPT
17
+ content_tag(:script, script.html_safe, :type => 'text/javascript')
18
+ end
16
19
  end
17
20
 
18
21
  end
@@ -2,8 +2,8 @@ module Analytics
2
2
  module Rails
3
3
  class Railtie < ::Rails::Railtie
4
4
 
5
- ActiveSupport.on_load(:action_view) do
6
- include Analytics::Rails::Helpers
5
+ initializer 'analytics.helpers' do
6
+ ActionView::Base.send :include, Analytics::Rails::Helpers
7
7
  end
8
8
 
9
9
  end
@@ -1,7 +1,7 @@
1
1
  module Analytics
2
2
  module Rails
3
3
 
4
- VERSION = '0.0.1'
4
+ VERSION = '0.0.2'
5
5
 
6
6
  end
7
7
  end
File without changes
@@ -0,0 +1,93 @@
1
+ Connecting to database specified by database.yml
2
+
3
+
4
+ Started GET "/" for 127.0.0.1 at 2013-04-03 16:02:00 -0300
5
+ Processing by StaticsController#home as HTML
6
+ Rendered statics/home.html.erb within layouts/application (6.3ms)
7
+ Compiled application.css (1ms) (pid 52155)
8
+ Compiled jquery.js (3ms) (pid 52155)
9
+ Compiled jquery_ujs.js (1ms) (pid 52155)
10
+ Compiled application.js (84ms) (pid 52155)
11
+ Completed 200 OK in 209ms (Views: 208.4ms | ActiveRecord: 0.0ms)
12
+
13
+
14
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-04-03 16:02:01 -0300
15
+ Served asset /application.css - 304 Not Modified (4ms)
16
+
17
+
18
+ Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2013-04-03 16:02:01 -0300
19
+ Served asset /jquery.js - 304 Not Modified (3ms)
20
+
21
+
22
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-04-03 16:02:01 -0300
23
+ Served asset /application.js - 304 Not Modified (5ms)
24
+
25
+
26
+ Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2013-04-03 16:02:01 -0300
27
+ Served asset /jquery_ujs.js - 304 Not Modified (2ms)
28
+ Connecting to database specified by database.yml
29
+
30
+
31
+ Started GET "/" for 127.0.0.1 at 2013-04-03 16:05:37 -0300
32
+ Processing by StaticsController#home as HTML
33
+ Rendered statics/home.html.erb within layouts/application (3.6ms)
34
+ Completed 200 OK in 38ms (Views: 37.8ms | ActiveRecord: 0.0ms)
35
+
36
+
37
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-04-03 16:05:37 -0300
38
+ Served asset /application.css - 304 Not Modified (2ms)
39
+
40
+
41
+ Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2013-04-03 16:05:37 -0300
42
+ Served asset /jquery.js - 304 Not Modified (6ms)
43
+
44
+
45
+ Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2013-04-03 16:05:37 -0300
46
+ Served asset /jquery_ujs.js - 304 Not Modified (4ms)
47
+
48
+
49
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-04-03 16:05:37 -0300
50
+ Served asset /application.js - 304 Not Modified (9ms)
51
+ Connecting to database specified by database.yml
52
+
53
+
54
+ Started GET "/" for 127.0.0.1 at 2013-04-03 16:07:55 -0300
55
+ Processing by StaticsController#home as HTML
56
+ Rendered statics/home.html.erb within layouts/application (3.1ms)
57
+ Completed 200 OK in 32ms (Views: 31.4ms | ActiveRecord: 0.0ms)
58
+ Connecting to database specified by database.yml
59
+
60
+
61
+ Started GET "/" for 127.0.0.1 at 2013-04-03 16:08:11 -0300
62
+ Processing by StaticsController#home as HTML
63
+ Rendered statics/home.html.erb within layouts/application (2.7ms)
64
+ Completed 200 OK in 53ms (Views: 52.6ms | ActiveRecord: 0.0ms)
65
+
66
+
67
+ Started GET "/" for 127.0.0.1 at 2013-04-03 16:08:20 -0300
68
+ Processing by StaticsController#home as HTML
69
+ Rendered statics/home.html.erb within layouts/application (0.0ms)
70
+ Completed 200 OK in 5ms (Views: 5.0ms | ActiveRecord: 0.0ms)
71
+
72
+
73
+ Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2013-04-03 16:08:20 -0300
74
+ Served asset /jquery_ujs.js - 304 Not Modified (2ms)
75
+
76
+
77
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-04-03 16:08:20 -0300
78
+ Served asset /application.css - 304 Not Modified (2ms)
79
+
80
+
81
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-04-03 16:08:20 -0300
82
+ Served asset /application.js - 304 Not Modified (6ms)
83
+
84
+
85
+ Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2013-04-03 16:08:20 -0300
86
+ Served asset /jquery.js - 304 Not Modified (3ms)
87
+ Connecting to database specified by database.yml
88
+
89
+
90
+ Started GET "/" for 127.0.0.1 at 2013-04-03 16:17:42 -0300
91
+ Processing by StaticsController#home as HTML
92
+ Rendered statics/home.html.erb within layouts/application (3.1ms)
93
+ Completed 200 OK in 33ms (Views: 32.8ms | ActiveRecord: 0.0ms)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: analytics-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-01 00:00:00.000000000 Z
12
+ date: 2013-04-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -82,6 +82,8 @@ files:
82
82
  - test/dummy/config/locales/en.yml
83
83
  - test/dummy/config/routes.rb
84
84
  - test/dummy/config.ru
85
+ - test/dummy/db/development.sqlite3
86
+ - test/dummy/log/development.log
85
87
  - test/dummy/log/test.log
86
88
  - test/dummy/public/404.html
87
89
  - test/dummy/public/422.html
@@ -90,6 +92,16 @@ files:
90
92
  - test/dummy/Rakefile
91
93
  - test/dummy/README.rdoc
92
94
  - test/dummy/script/rails
95
+ - test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953
96
+ - test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
97
+ - test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655
98
+ - test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
99
+ - test/dummy/tmp/cache/assets/D9B/E00/sprockets%2Fb66a75bd10bef6da5f16f4fa9113926c
100
+ - test/dummy/tmp/cache/assets/DAC/650/sprockets%2Ff8ec2e25f819797cb9a491d0af22ae9b
101
+ - test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994
102
+ - test/dummy/tmp/cache/assets/DEF/100/sprockets%2F8b9d88bfa8f8eed7910469ef2ab8a8c7
103
+ - test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
104
+ - test/dummy/tmp/cache/assets/E29/AA0/sprockets%2F6eaab4ab4dbae1b8b5a6f9286aa966d4
93
105
  - test/test_helper.rb
94
106
  homepage: https://github.com/mattways/analytics-rails
95
107
  licenses: []
@@ -140,6 +152,8 @@ test_files:
140
152
  - test/dummy/config/locales/en.yml
141
153
  - test/dummy/config/routes.rb
142
154
  - test/dummy/config.ru
155
+ - test/dummy/db/development.sqlite3
156
+ - test/dummy/log/development.log
143
157
  - test/dummy/log/test.log
144
158
  - test/dummy/public/404.html
145
159
  - test/dummy/public/422.html
@@ -148,4 +162,14 @@ test_files:
148
162
  - test/dummy/Rakefile
149
163
  - test/dummy/README.rdoc
150
164
  - test/dummy/script/rails
165
+ - test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953
166
+ - test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
167
+ - test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655
168
+ - test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
169
+ - test/dummy/tmp/cache/assets/D9B/E00/sprockets%2Fb66a75bd10bef6da5f16f4fa9113926c
170
+ - test/dummy/tmp/cache/assets/DAC/650/sprockets%2Ff8ec2e25f819797cb9a491d0af22ae9b
171
+ - test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994
172
+ - test/dummy/tmp/cache/assets/DEF/100/sprockets%2F8b9d88bfa8f8eed7910469ef2ab8a8c7
173
+ - test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
174
+ - test/dummy/tmp/cache/assets/E29/AA0/sprockets%2F6eaab4ab4dbae1b8b5a6f9286aa966d4
151
175
  - test/test_helper.rb