analytics-rails 0.3.4 → 4.0.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c9c5ff2a82ba6b5ac6710f3ddc9182b16422e79
4
- data.tar.gz: aff5d90f8e35aae72b24adfdbeb7ddecdecb8d48
3
+ metadata.gz: 8d09071276ad2dadae4b4142886454dedcfe3341
4
+ data.tar.gz: 4120d525f30939ff7b8a3bc07f451d614f707094
5
5
  SHA512:
6
- metadata.gz: c6960cd38d01777676e103380aaead46a7215d2e5bcf9e25606d9d6f104914c23601029230780879823435e4c841dac4f2f9358a4e391f3eba699bf1fcea5d93
7
- data.tar.gz: 3e260ba74f22108697407de4355076f428bde4645231fb61eb1f1105596c2c515f8401dcef433d1f73f9260395973f34c72becac784404bb239d9a145e76e2dd
6
+ metadata.gz: 123e7ba1f43a212c93e744f55eee20f515bfe4219cb067577859c702c1973f4d1f7c8835bbe2bf5055401c254c1425a0730713252a173295ad60b684748063ee
7
+ data.tar.gz: 8110f8364f6cc9e68ddfbcaa7a731710c0c8613a09b17ceab274d2fa0b045ca9e494accfae4e5940e2946c52d1ba370ea329bfb16a91ba14c8d2cf7bdb67277e
data/README.md CHANGED
@@ -33,12 +33,12 @@ Include tag must be added before any other tag in order to work and only will be
33
33
 
34
34
  In your layout add a line like this in your head:
35
35
  ```erb
36
- <%= google_analytics_include_tag 'id' %>
36
+ <%= google_analytics_include_tag 'UA-000000-01' %>
37
37
  ```
38
38
 
39
39
  You can add metrics if you want:
40
40
  ```erb
41
- <%= google_analytics_include_tag 'id', metric: 'value' %>
41
+ <%= google_analytics_include_tag 'UA-000000-01', category: 'products' %>
42
42
  ```
43
43
 
44
44
  ### Events
@@ -50,7 +50,7 @@ To send events add a line like this with the category and action:
50
50
 
51
51
  You can add label, value and other options too if you want:
52
52
  ```erb
53
- <%= google_analytics_event_tag 'Video', 'play', 'Fall Campaign', 42, metric: 'value' %>
53
+ <%= google_analytics_event_tag 'Video', 'play', 'demo.mp4', 42, category: 'product' %>
54
54
  ```
55
55
 
56
56
  ## Credits
@@ -12,7 +12,7 @@ module Analytics
12
12
  (function(i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function(){
13
13
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
14
14
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
15
- })(window,document,"script","https://www.google-analytics.com/analytics.js","ga");
15
+ })(window,document,"script","#{request.protocol}www.google-analytics.com/analytics.js","ga");
16
16
  ga("create", "#{id}", "auto");
17
17
  ga("send", "pageview", #{options});
18
18
  SCRIPT
@@ -2,7 +2,7 @@ module Analytics
2
2
  module Rails
3
3
  class Railtie < ::Rails::Railtie
4
4
 
5
- initializer :analytics do
5
+ initializer 'analytics.extensions' do
6
6
  ::ActionView::Base.include(
7
7
  Analytics::Rails::Extensions::ActionView::Base
8
8
  )
@@ -1,7 +1,7 @@
1
1
  module Analytics
2
2
  module Rails
3
3
 
4
- VERSION = '0.3.4'
4
+ VERSION = '4.0.0.0'
5
5
 
6
6
  end
7
7
  end
@@ -157,3 +157,21 @@ TagTest: test_event
157
157
  ---------------------
158
158
  TagTest: test_include
159
159
  ---------------------
160
+ -------------------
161
+ TagTest: test_event
162
+ -------------------
163
+ ---------------------
164
+ TagTest: test_include
165
+ ---------------------
166
+ -------------------
167
+ TagTest: test_event
168
+ -------------------
169
+ ---------------------
170
+ TagTest: test_include
171
+ ---------------------
172
+ ---------------------
173
+ TagTest: test_include
174
+ ---------------------
175
+ -------------------
176
+ TagTest: test_event
177
+ -------------------
@@ -1,16 +1,19 @@
1
1
  require 'test_helper'
2
2
 
3
- class TagTest < ActionView::TestCase
3
+ class ViewTest < ActionView::TestCase
4
4
 
5
5
  test 'include' do
6
+ self.request = ActionDispatch::TestRequest.new
6
7
  with_env 'production' do
7
8
  tag = google_analytics_include_tag('id')
8
9
  assert_includes tag, 'ga("create", "id", "auto");'
9
10
  assert_includes tag, 'ga("send", "pageview", {});'
11
+ assert_includes tag, 'http://www.google-analytics.com/analytics.js'
10
12
 
11
13
  tag = google_analytics_include_tag('id', other: 'value')
12
14
  assert_includes tag, 'ga("create", "id", "auto");'
13
15
  assert_includes tag, 'ga("send", "pageview", {"other":"value"});'
16
+ assert_includes tag, 'http://www.google-analytics.com/analytics.js'
14
17
  end
15
18
 
16
19
  with_env 'development' do
@@ -24,6 +27,7 @@ class TagTest < ActionView::TestCase
24
27
  google_analytics_event_tag('Popup', 'click'),
25
28
  'ga("send", "event", "Popup", "click", {});'
26
29
  )
30
+
27
31
  assert_includes(
28
32
  google_analytics_event_tag('Video', 'play', 'ad.mp4', 10, non_interactive: 'value'),
29
33
  'ga("send", "event", "Video", "play", "ad.mp4", 10, {"nonInteractive":"value"});'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: analytics-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 4.0.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - mmontossi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-28 00:00:00.000000000 Z
11
+ date: 2016-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -79,8 +79,8 @@ files:
79
79
  - test/dummy/public/422.html
80
80
  - test/dummy/public/500.html
81
81
  - test/dummy/public/favicon.ico
82
- - test/tag_test.rb
83
82
  - test/test_helper.rb
83
+ - test/view_test.rb
84
84
  homepage: https://github.com/mmontossi/analytics-rails
85
85
  licenses:
86
86
  - MIT
@@ -140,5 +140,5 @@ test_files:
140
140
  - test/dummy/public/500.html
141
141
  - test/dummy/public/favicon.ico
142
142
  - test/dummy/Rakefile
143
- - test/tag_test.rb
144
143
  - test/test_helper.rb
144
+ - test/view_test.rb