gtm_on_rails 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.ja.md +7 -7
- data/README.md +7 -7
- data/lib/gtm_on_rails/models/data_layer/ecommerce.rb +17 -3
- data/lib/gtm_on_rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a98db43f94fbddb2e1e5141b5953f81c3bf6d90d
|
4
|
+
data.tar.gz: 4e833f8a318aff40b6477e891324138566c9a18f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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::
|
55
|
+
#### `GtmOnRails::DataLayer::Object`
|
56
56
|
```ruby
|
57
|
-
object = GtmOnRails::
|
57
|
+
object = GtmOnRails::DataLayer::Object.new({name: 'name'})
|
58
58
|
data_layer.push(object)
|
59
59
|
```
|
60
|
-
Hash形式ではなく、上記のように`GtmOnRails::
|
60
|
+
Hash形式ではなく、上記のように`GtmOnRails::DataLayer::Object`クラスを用いることもできます。
|
61
61
|
|
62
62
|
```ruby
|
63
|
-
object = GtmOnRails::
|
63
|
+
object = GtmOnRails::DataLayer::Object.new({name: 'name'})
|
64
64
|
object.name
|
65
65
|
object.name = 'name2'
|
66
66
|
```
|
67
|
-
`GtmOnRails::
|
67
|
+
`GtmOnRails::DataLayer::Object`クラスでは、上記のように値にアクセスできます。
|
68
68
|
|
69
|
-
#### `GtmOnRails::
|
69
|
+
#### `GtmOnRails::DataLayer::Event`
|
70
70
|
```ruby
|
71
|
-
event = GtmOnRails::
|
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::
|
55
|
+
#### `GtmOnRails::DataLayer::Object`
|
56
56
|
```ruby
|
57
|
-
object = GtmOnRails::
|
57
|
+
object = GtmOnRails::DataLayer::Object.new({name: 'name'})
|
58
58
|
data_layer.push(object)
|
59
59
|
```
|
60
|
-
You also can use `GtmOnRails::
|
60
|
+
You also can use `GtmOnRails::DataLayer::Object` object rather than Hash as the above.
|
61
61
|
|
62
62
|
```ruby
|
63
|
-
object = GtmOnRails::
|
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::
|
67
|
+
You can access values with `GtmOnRails::DataLayer::Object` object as the above.
|
68
68
|
|
69
|
-
#### `GtmOnRails::
|
69
|
+
#### `GtmOnRails::DataLayer::Event`
|
70
70
|
```ruby
|
71
|
-
event = GtmOnRails::
|
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
|
|
data/lib/gtm_on_rails/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2017-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|