gtm_on_rails 0.1.5 → 0.1.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 20b03197ee5403fbb9798f2542967ac06455d533
4
- data.tar.gz: 573fe001b486037942939d5f969dcee799a622e3
3
+ metadata.gz: a98db43f94fbddb2e1e5141b5953f81c3bf6d90d
4
+ data.tar.gz: 4e833f8a318aff40b6477e891324138566c9a18f
5
5
  SHA512:
6
- metadata.gz: 95577feac38fae6ed55de4da7ac9bed3f95bd57476f8c0f38846557dcb523af05dc98634e557e429f2e8b54fd48866077a0c0849590919c416dac36e8aae5373
7
- data.tar.gz: b287e7c290cf85c1ade3ff46c6587a232ab74a679afba9df6db0a6896e7dbfab925735ae92e55b38cd88c2f793d9a6f5c8fb487764fde638e208f43ba1a4b50f
6
+ metadata.gz: '09f47a25bf6389a17c37b0f3a4022909aa136ee1075a3a9cf15a8d44d3ed9d087f5310505b6bbf403823883fb264dd983c1623c9974ad09a83e7927a117df6bd'
7
+ data.tar.gz: bbcb4b81733815ebbebcd5f63d1f2660af3c609be94cd8b4f059666990f080c259aaa702726c915da2de74295235bffde8c0f01790e95efe592eaae9700719eb
data/README.ja.md CHANGED
@@ -52,23 +52,23 @@ data_layer.push({
52
52
 
53
53
  送信したdataLayerの内容は、GoogleTagManager側で変数に設定する等して使用して下さい。
54
54
 
55
- #### `GtmOnRails::DataLayerObject`
55
+ #### `GtmOnRails::DataLayer::Object`
56
56
  ```ruby
57
- object = GtmOnRails::DataLayerObject.new({name: 'name'})
57
+ object = GtmOnRails::DataLayer::Object.new({name: 'name'})
58
58
  data_layer.push(object)
59
59
  ```
60
- Hash形式ではなく、上記のように`GtmOnRails::DataLayerObject`クラスを用いることもできます。
60
+ Hash形式ではなく、上記のように`GtmOnRails::DataLayer::Object`クラスを用いることもできます。
61
61
 
62
62
  ```ruby
63
- object = GtmOnRails::DataLayerObject.new({name: 'name'})
63
+ object = GtmOnRails::DataLayer::Object.new({name: 'name'})
64
64
  object.name
65
65
  object.name = 'name2'
66
66
  ```
67
- `GtmOnRails::DataLayerObject`クラスでは、上記のように値にアクセスできます。
67
+ `GtmOnRails::DataLayer::Object`クラスでは、上記のように値にアクセスできます。
68
68
 
69
- #### `GtmOnRails::DataLayerEvent`
69
+ #### `GtmOnRails::DataLayer::Event`
70
70
  ```ruby
71
- event = GtmOnRails::DataLayerEvent.new('イベント名', {name: 'name'})
71
+ event = GtmOnRails::DataLayer::Event.new('イベント名', {name: 'name'})
72
72
  data_layer.push(event)
73
73
  ```
74
74
  上記のように記述することで、イベント名を設定して送信できます。
data/README.md CHANGED
@@ -52,23 +52,23 @@ data_layer.push({
52
52
  ```
53
53
  Configure the variable and so on Google Tag Manager when use sended values.
54
54
 
55
- #### `GtmOnRails::DataLayerObject`
55
+ #### `GtmOnRails::DataLayer::Object`
56
56
  ```ruby
57
- object = GtmOnRails::DataLayerObject.new({name: 'name'})
57
+ object = GtmOnRails::DataLayer::Object.new({name: 'name'})
58
58
  data_layer.push(object)
59
59
  ```
60
- You also can use `GtmOnRails::DataLayerObject` object rather than Hash as the above.
60
+ You also can use `GtmOnRails::DataLayer::Object` object rather than Hash as the above.
61
61
 
62
62
  ```ruby
63
- object = GtmOnRails::DataLayerObject.new({name: 'name'})
63
+ object = GtmOnRails::DataLayer::Object.new({name: 'name'})
64
64
  object.name
65
65
  object.name = 'name2'
66
66
  ```
67
- You can access values with `GtmOnRails::DataLayerObject` object as the above.
67
+ You can access values with `GtmOnRails::DataLayer::Object` object as the above.
68
68
 
69
- #### `GtmOnRails::DataLayerEvent`
69
+ #### `GtmOnRails::DataLayer::Event`
70
70
  ```ruby
71
- event = GtmOnRails::DataLayerEvent.new('event_name', {name: 'name'})
71
+ event = GtmOnRails::DataLayer::Event.new('event_name', {name: 'name'})
72
72
  data_layer.push(event)
73
73
  ```
74
74
  You can send dataLayer with Google Tag Manager's event name, when write like the above code.
@@ -27,6 +27,8 @@ module GtmOnRails
27
27
  def generate_product_impression_hash(args)
28
28
  result = {}
29
29
 
30
+ result[:event] = args[:event] if args[:event].present?
31
+
30
32
  result[:ecommerce] = {}
31
33
  result[:ecommerce][:currencyCode] = args[:currency] || GtmOnRails.config.ecommerce_default_currency
32
34
 
@@ -40,6 +42,8 @@ module GtmOnRails
40
42
  def generate_product_click_hash(args)
41
43
  result = {}
42
44
 
45
+ result[:event] = args[:event] || 'productClick'
46
+
43
47
  result[:event_category] = args[:event_category] || 'Enhanced Ecommerce'
44
48
  result[:event_action] = args[:event_action] || 'Product Click'
45
49
  result[:event_label] = args[:event_label] || 'Enhanced Ecommerce Product Click'
@@ -64,6 +68,8 @@ module GtmOnRails
64
68
  def generate_product_detail_hash(args)
65
69
  result = {}
66
70
 
71
+ result[:event] = args[:event] if args[:event].present?
72
+
67
73
  result[:ecommerce] = {}
68
74
  result[:ecommerce][:currencyCode] = args[:currency] || GtmOnRails.config.ecommerce_default_currency
69
75
 
@@ -84,7 +90,7 @@ module GtmOnRails
84
90
  def generate_add_to_cart_hash(args)
85
91
  result = {}
86
92
 
87
- result[:event] = 'addToCart'
93
+ result[:event] = args[:event] || 'addToCart'
88
94
 
89
95
  result[:event_category] = args[:event_category] || 'Enhanced Ecommerce'
90
96
  result[:event_action] = args[:event_action] || 'Add to Cart'
@@ -104,6 +110,8 @@ module GtmOnRails
104
110
  def generate_remove_from_cart_hash(args)
105
111
  result = {}
106
112
 
113
+ result[:event] = args[:event] || 'removeFromCart'
114
+
107
115
  result[:event_category] = args[:event_category] || 'Enhanced Ecommerce'
108
116
  result[:event_action] = args[:event_action] || 'Remove from Cart'
109
117
  result[:event_label] = args[:event_label] || 'Enhanced Ecommerce Remove from Cart'
@@ -122,6 +130,8 @@ module GtmOnRails
122
130
  def generate_promotion_impression_hash(args)
123
131
  result = {}
124
132
 
133
+ result[:event] = args[:event] if args[:event].present?
134
+
125
135
  result[:ecommerce] = {}
126
136
  result[:ecommerce][:currencyCode] = args[:currency] || GtmOnRails.config.ecommerce_default_currency
127
137
 
@@ -137,7 +147,7 @@ module GtmOnRails
137
147
  def generate_promotion_click_hash(args)
138
148
  result = {}
139
149
 
140
- result[:event] = 'promotionClick'
150
+ result[:event] = args[:event] || 'promotionClick'
141
151
 
142
152
  result[:event_category] = args[:event_category] || 'Enhanced Ecommerce'
143
153
  result[:event_action] = args[:event_action] || 'Promotion Click'
@@ -158,7 +168,7 @@ module GtmOnRails
158
168
  def generate_checkout_hash(args)
159
169
  result = {}
160
170
 
161
- result[:event] = 'checkout'
171
+ result[:event] = args[:event] || 'checkout'
162
172
 
163
173
  result[:event_category] = args[:event_category] || 'Enhanced Ecommerce'
164
174
  result[:event_action] = args[:event_action] || 'Checkout'
@@ -184,6 +194,8 @@ module GtmOnRails
184
194
  def generate_purchase_hash(args)
185
195
  result = {}
186
196
 
197
+ result[:event] = args[:event] if args[:event].present?
198
+
187
199
  result[:ecommerce] = {}
188
200
  result[:ecommerce][:currencyCode] = args[:currency] || GtmOnRails.config.ecommerce_default_currency
189
201
 
@@ -203,6 +215,8 @@ module GtmOnRails
203
215
  def generate_refund_hash(args)
204
216
  result = {}
205
217
 
218
+ result[:event] = args[:event] if args[:event].present?
219
+
206
220
  result[:ecommerce] = {}
207
221
  result[:ecommerce][:currencyCode] = args[:currency] || GtmOnRails.config.ecommerce_default_currency
208
222
 
@@ -1,3 +1,3 @@
1
1
  module GtmOnRails
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
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.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - ykogure
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-25 00:00:00.000000000 Z
11
+ date: 2017-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails