gtm_on_rails 0.1.2 → 0.1.3

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: 161f6aefbee25eb72bbde39f556a1d31922c9e85
4
- data.tar.gz: 02ed437da032b4b921858401559a5acfcebe84cd
3
+ metadata.gz: d930846667618746fbb6cdbc1f74928f6118006e
4
+ data.tar.gz: e5ec635f9ac76d4c4f0c3d2f52ef1fe7fa2fec8f
5
5
  SHA512:
6
- metadata.gz: 04f69bbb0adffce5e6994147dee884009ec61a5c8ba90c7c09ce932177c433518cd8ae47ef5e3fcd2be4fd71ba330be826c8c043ab9d1d241fe92063d068c255
7
- data.tar.gz: 0cce859b62d1a8f8c3fb8487f9515546be86c9fce823755d2af346ddecfe9c33b314919ae015861888adde7495035bc40a25813dcdfeebca4e4216c513638e6d
6
+ metadata.gz: 2897d0a268ec2d22f5c279d7e6d8da138222174cf8e12daa5a4ebd1eac268f23c448884bea2f7a7d78d0730c7b698e187ef7c045c949f14e617b94b51634fc85
7
+ data.tar.gz: 118b23cb8e9f61f0db51c0fcf4d5d2a2af16a420596bfe49f4e073ef77ea25880ca71d262c161130a7518005fecfec233b862468acaaf9462120fb46c20096ad
data/README.ja.md CHANGED
@@ -59,7 +59,8 @@ Hash形式ではなく、上記のように`GtmOnRails::DataLayerObject`クラ
59
59
 
60
60
  ```ruby
61
61
  object = GtmOnRails::DataLayerObject.new({name: 'name'})
62
- puts object.name
62
+ object.name
63
+ object.name = 'name2'
63
64
  ```
64
65
  `GtmOnRails::DataLayerObject`クラスでは、上記のように値にアクセスできます。
65
66
 
data/README.md CHANGED
@@ -58,13 +58,14 @@ You also can use `GtmOnRails::DataLayerObject` object rather than Hash as the ab
58
58
 
59
59
  ```ruby
60
60
  object = GtmOnRails::DataLayerObject.new({name: 'name'})
61
- puts object.name
61
+ object.name
62
+ object.name = 'name2'
62
63
  ```
63
64
  You can access values with `GtmOnRails::DataLayerObject` object as the above.
64
65
 
65
66
  #### `GtmOnRails::DataLayerEvent`
66
67
  ```ruby
67
- event = GtmOnRails::DataLayerEvent.new('イベント名', {name: 'name'})
68
+ event = GtmOnRails::DataLayerEvent.new('event_name', {name: 'name'})
68
69
  data_layer.push(event)
69
70
  ```
70
71
  You can send dataLayer with Google Tag Manager's event name, when write like the above code.
@@ -1,7 +1,12 @@
1
1
  <% begin %>
2
- <%= data_layer.print_on_js %>
2
+ <%= data_layer.print_on_html %>
3
3
  <%-
4
- rescue StandardError => e
5
- raise e unless GtmOnRails.config.rescue_when_error_occurred
4
+ rescue => e
5
+ if GtmOnRails.config.rescue_when_error_occurred
6
+ logger.warn(e.message)
7
+ logger.warn(e.backtrace.join("\n"))
8
+ else
9
+ raise e
10
+ end
6
11
  end
7
12
  -%>
@@ -22,7 +22,7 @@ module GtmOnRails
22
22
  end
23
23
  end
24
24
 
25
- def print_on_js
25
+ def to_js
26
26
  js_codes = []
27
27
 
28
28
  js_codes << "var dataLayer = dataLayer || [];"
@@ -30,13 +30,18 @@ module GtmOnRails
30
30
  # dataLayer size limit exception
31
31
  size = data_layer_object.to_json.bytesize
32
32
  if size > GtmOnRails.config.data_layer_limit_byte_size
33
- raise ArgumentError.new("DataLayer bytesize is over limit #{GtmOnRails.config.data_layer_limit_byte_size} bytes. Size is #{size} bytes.")
33
+ logger.warn("DataLayer bytesize is over limit #{GtmOnRails.config.data_layer_limit_byte_size} bytes. Size is #{size} bytes.")
34
+ next
34
35
  end
35
36
 
36
37
  js_codes << data_layer_object.to_js
37
38
  end
38
39
 
39
- return content_tag(:script, js_codes.join.html_safe)
40
+ return js_codes.join.html_safe
41
+ end
42
+
43
+ def print_on_html
44
+ content_tag(:script, self.to_js)
40
45
  end
41
46
  end
42
47
  end
@@ -1,3 +1,3 @@
1
1
  module GtmOnRails
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gtm_on_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ykogure
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-03 00:00:00.000000000 Z
11
+ date: 2017-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails