workarea-google_tag_manager 4.3.1

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.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.rubocop.yml +37 -0
  4. data/CHANGELOG.md +100 -0
  5. data/Gemfile +14 -0
  6. data/README.md +339 -0
  7. data/Rakefile +65 -0
  8. data/app/assets/javascripts/workarea/storefront/google_tag_manager/modules/adapter.js +233 -0
  9. data/app/views/workarea/storefront/google_tag_manager/_no_script.html.haml +3 -0
  10. data/app/views/workarea/storefront/google_tag_manager/_script.html.haml +3 -0
  11. data/bin/rails +18 -0
  12. data/config/initializers/appends.rb +16 -0
  13. data/config/initializers/workarea.rb +3 -0
  14. data/lib/workarea/google_tag_manager.rb +60 -0
  15. data/lib/workarea/google_tag_manager/engine.rb +8 -0
  16. data/lib/workarea/google_tag_manager/version.rb +5 -0
  17. data/script/admin_ci +9 -0
  18. data/script/ci +11 -0
  19. data/script/core_ci +9 -0
  20. data/script/plugins_ci +9 -0
  21. data/script/storefront_ci +9 -0
  22. data/test/dummy/Rakefile +6 -0
  23. data/test/dummy/bin/bundle +3 -0
  24. data/test/dummy/bin/rails +4 -0
  25. data/test/dummy/bin/rake +4 -0
  26. data/test/dummy/bin/setup +34 -0
  27. data/test/dummy/bin/update +29 -0
  28. data/test/dummy/config.ru +5 -0
  29. data/test/dummy/config/application.rb +28 -0
  30. data/test/dummy/config/boot.rb +5 -0
  31. data/test/dummy/config/cable.yml +9 -0
  32. data/test/dummy/config/environment.rb +5 -0
  33. data/test/dummy/config/environments/development.rb +54 -0
  34. data/test/dummy/config/environments/production.rb +86 -0
  35. data/test/dummy/config/environments/test.rb +43 -0
  36. data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
  37. data/test/dummy/config/initializers/assets.rb +11 -0
  38. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  39. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  40. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  41. data/test/dummy/config/initializers/inflections.rb +16 -0
  42. data/test/dummy/config/initializers/mime_types.rb +4 -0
  43. data/test/dummy/config/initializers/new_framework_defaults.rb +21 -0
  44. data/test/dummy/config/initializers/session_store.rb +3 -0
  45. data/test/dummy/config/initializers/workarea.rb +5 -0
  46. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  47. data/test/dummy/config/locales/en.yml +23 -0
  48. data/test/dummy/config/puma.rb +47 -0
  49. data/test/dummy/config/routes.rb +5 -0
  50. data/test/dummy/config/secrets.yml +22 -0
  51. data/test/dummy/config/spring.rb +6 -0
  52. data/test/dummy/lib/assets/.keep +0 -0
  53. data/test/dummy/log/.keep +0 -0
  54. data/test/javascripts/fixtures/payloads.js +231 -0
  55. data/test/javascripts/google_tag_manager_spec.js +382 -0
  56. data/test/javascripts/spec_helper.js +5 -0
  57. data/test/teaspoon_env.rb +10 -0
  58. data/test/test_helper.rb +10 -0
  59. data/workarea-google_tag_manager.gemspec +18 -0
  60. metadata +151 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3e62fb8271ea1777685547babd1b71cb82f66a5fc39a02e576602c2774a0c82a
4
+ data.tar.gz: 75c64904c8445a2700f744b4f20df741dd3f05dff0c56c778057d5f0e89778d9
5
+ SHA512:
6
+ metadata.gz: 8b57ca62a985a5d564eb0cc1a03258daa3294ba174e8a76adbd749beb6afe220238f6212bcbc6375d15f107041d3123a37a620efe4b5e2304c35388b369e23f8
7
+ data.tar.gz: 9c1499a0b53f85743e5c3c86a32046ac23621d0cade420b18b71c78f17a9101acce7ef9d6e392480144b618fa239fdc94632468c39d3b6a4157a394967d4f81c
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ test/dummy/db/*.sqlite3
5
+ test/dummy/db/*.sqlite3-journal
6
+ test/dummy/log/*.log
7
+ test/dummy/tmp/
8
+ test/dummy/.sass-cache
9
+ Gemfile.lock
10
+ test/dummy/public/*
11
+ .DS_STORE
data/.rubocop.yml ADDED
@@ -0,0 +1,37 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2017-05-02 15:21:42 -0400 using RuboCop version 0.46.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 24
10
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
11
+ # URISchemes: http, https
12
+ AllCops:
13
+ Exclude:
14
+ - 'Rakefile'
15
+ - 'test/dummy/**/*'
16
+ - 'lib/workarea/google_tag_manager.rb'
17
+ - 'lib/workarea/google_tag_manager/**/*'
18
+
19
+ Metrics/LineLength:
20
+ Exclude:
21
+ - 'workarea-google_tag_manager.gemspec'
22
+
23
+ Style/Documentation:
24
+ Enabled: false
25
+
26
+ # Offense count: 1
27
+ # Cop supports --auto-correct.
28
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
29
+ # SupportedStyles: use_perl_names, use_english_names
30
+ Style/SpecialGlobalVars:
31
+ Exclude:
32
+ - 'workarea-google_tag_manager.gemspec'
33
+
34
+ # Offense count: 1
35
+ Metrics/LineLength:
36
+ Exclude:
37
+ - 'workarea-google_tag_manager.gemspec'
data/CHANGELOG.md ADDED
@@ -0,0 +1,100 @@
1
+ Workarea Google Tag Manager 4.3.1 (2019-08-21)
2
+ --------------------------------------------------------------------------------
3
+
4
+ * Open Source!
5
+
6
+
7
+
8
+ Workarea Google Tag Manager 4.3.0 (2019-05-28)
9
+ --------------------------------------------------------------------------------
10
+
11
+ * Move GTM script to the site head
12
+
13
+ Move GTM script portion into its own partial.
14
+ Rename no script partial.
15
+ Update append points. Script will now be appended to the head.
16
+
17
+ WLGTM-13
18
+ James Dobson
19
+
20
+
21
+
22
+ Workarea Google Tag Manager 4.2.6 (2019-04-16)
23
+ --------------------------------------------------------------------------------
24
+
25
+ * Update for v3.4 compatibility
26
+
27
+ * Add CI scripts
28
+ * update gemfile for v3.4
29
+ * Fix ESlint errors
30
+ * Update rubocop configuration and get the cops passing
31
+ * Add keepfile for test/dummy/tmp/screenshots
32
+
33
+ WLGTM-12
34
+ Jake Beresford
35
+
36
+
37
+
38
+ Workarea Google Tag Manager 4.2.5 (2019-02-19)
39
+ --------------------------------------------------------------------------------
40
+
41
+ * Correct casing of productQuickview adapter callback function name
42
+
43
+ WLGTM-11
44
+ Jake Beresford
45
+
46
+
47
+
48
+ Workarea Google Tag Manager 4.2.4 (2018-12-11)
49
+ --------------------------------------------------------------------------------
50
+
51
+ * Remove unecessary tests causing issues in builds
52
+
53
+ WLGTM-10
54
+ Eric Pigeon
55
+
56
+
57
+
58
+ Workarea Google Tag Manager 4.2.3 (2018-10-30)
59
+ --------------------------------------------------------------------------------
60
+
61
+ * Update implementation of container ID to use configuration rather than secrets
62
+
63
+ This change allows much easier per-site configuration of GTM for multi-site applications.
64
+
65
+ * Includes a fallback to secrets for configuration but prefers apps to use configuration over secrets
66
+
67
+ WLGTM-9
68
+ Jake Beresford
69
+
70
+
71
+
72
+ Workarea Google Tag Manager 4.2.2 (2018-04-11)
73
+ --------------------------------------------------------------------------------
74
+
75
+ * Remove duplicate closing script tag
76
+
77
+ WLGTM-8
78
+ Kristin Henson
79
+
80
+
81
+ Workarea Google Tag Manager 4.2.1 (2018-01-11)
82
+ --------------------------------------------------------------------------------
83
+
84
+ * Prevent GTM making external requests in test
85
+
86
+ WLGTM-6
87
+ Jake Beresford
88
+
89
+
90
+ Workarea Google Tag Manager 4.2.0 (2017-10-13)
91
+ --------------------------------------------------------------------------------
92
+
93
+ Developers - note that this change moves configuration of GTM container ID from
94
+ Workarea.config in to application secrets, you will need to update your secrets
95
+ file when taking this change. See README for instructions.
96
+
97
+ * Use secrets to configure Google Tag Manager
98
+
99
+ WLGTM-3
100
+ Jake Beresford
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Declare your gem's dependencies in tag_manager.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
6
+ gemspec
7
+
8
+ # Declare any dependencies that are still in development here instead of in
9
+ # your gemspec. These might include edge Rails or gems from your path or
10
+ # Git. Remember to move these dependencies to your gemspec before releasing
11
+ # your gem to rubygems.org.
12
+
13
+ # To use a debugger
14
+ gem 'workarea', source: 'https://gems.weblinc.com'
data/README.md ADDED
@@ -0,0 +1,339 @@
1
+ # Workarea Tag Manager
2
+
3
+ Google Tag Manager plugin for the Workarea platform.
4
+ Including Enhanced ecommerce configuration.
5
+
6
+ Do not use this plugin for Google Analytics, workarea-google-analytics is well maintained and provides more functionality for GA specifically.
7
+
8
+ Tag manager Sets up a dataLayer on the window and pushes all data to the dataLayer. This is read by GTM and can be used in custom variables.
9
+
10
+ ## Configuring Google Tag Manager
11
+
12
+ In your applications workarea.rb initializer add the following configuration
13
+
14
+ ```ruby
15
+ Workarea.config.google_tag_manager.container_id = 'your-container-id'
16
+ ```
17
+
18
+ ## Shared Events
19
+
20
+ These Events are re-used by many of the events detailed in the Summary of events below
21
+
22
+ ### Checkout Step
23
+
24
+ 'step' is a number equal to the checkout step
25
+
26
+ 1. Cart
27
+ 2. Addresses
28
+ 3. Shipping
29
+ 4. Payment
30
+
31
+ dataLayer:
32
+
33
+ 'event': 'checkout',
34
+ 'ecommerce': {
35
+ 'checkout': {
36
+ 'actionField': { 'step': step },
37
+ 'products': [
38
+ {
39
+ 'id': "4559F84840",
40
+ 'name': "Slim Ankle Pants",
41
+ 'category': "Women's Pants",
42
+ 'variant': "292205283-4",
43
+ 'price': 31.56,
44
+ 'quantity': 1
45
+ }
46
+ ]
47
+ }
48
+ }
49
+
50
+ ## Summary of Events
51
+
52
+ ### Category View
53
+
54
+ Sent on category show pages (aka product browse)
55
+
56
+ dataLayer:
57
+
58
+ 'event': 'categoryView',
59
+ 'name': 'Category Name',
60
+ 'sort': "top_sellers",
61
+ 'page': 1
62
+
63
+ ---
64
+
65
+ ### searchResultsView
66
+
67
+ Sent on search results page
68
+
69
+ dataLayer:
70
+
71
+ 'event': 'searchResultsView',
72
+ 'terms': 'red shirt',
73
+ 'sort': 'relevance',
74
+ 'page': 1
75
+
76
+ ---
77
+
78
+ ### Product List
79
+
80
+ Sent anywhere there are lists of products, including: product browse, search results, cart page, product recommendations, category summary content block, product list content block.
81
+
82
+ dataLayer:
83
+ 'ecommerce': {
84
+ 'impressions': [
85
+ {
86
+ 'id': "4559F84840",
87
+ 'price': 31.56,
88
+ 'name': "Slim Ankle Pants",
89
+ 'category': "Women's Pants",
90
+ 'variant': "292205283-4",
91
+ 'list': "Slim Ankle Pants",
92
+ 'position': 1
93
+ }
94
+ ]
95
+ }
96
+
97
+ ---
98
+
99
+ ### Product Click
100
+
101
+ Triggered when a user clicks on any product summary in the storefront.
102
+
103
+ dataLayer:
104
+
105
+ 'event': 'productClick',
106
+ 'ecommerce': {
107
+ 'click': {
108
+ 'actionField': {'list': "Women's Pants"},
109
+ 'products': [{
110
+ 'name': "Slim Ankle Pants",
111
+ 'id': "4559F84840",
112
+ 'price': 31.56,
113
+ 'category': "Women's Pants",
114
+ 'variant': "292205283-4",
115
+ 'position': 1
116
+ }]
117
+ }
118
+ }
119
+
120
+ ---
121
+
122
+ ### Product Quick View
123
+
124
+ Triggered when a user opens a product quickview
125
+
126
+ dataLayer:
127
+
128
+ 'event': 'quickview',
129
+ 'ecommerce': {
130
+ 'detail': {
131
+ 'actionField': '',
132
+ 'products': [{
133
+ 'name': "Slim Ankle Pants",
134
+ 'id': "4559F84840",
135
+ 'price': 31.56,
136
+ 'category': "Women's Pants",
137
+ 'variant': "292205283-4",
138
+ }]
139
+ }
140
+ }
141
+
142
+ ---
143
+
144
+ ### Product View
145
+
146
+ Triggered when a user visits the product detail page
147
+
148
+ dataLayer:
149
+
150
+ 'ecommerce': {
151
+ 'detail': {
152
+ 'actionField': '',
153
+ 'products': [{
154
+ 'name': "Slim Ankle Pants",
155
+ 'id': "4559F84840",
156
+ 'price': 31.56,
157
+ 'category': "Women's Pants",
158
+ 'variant': "292205283-4",
159
+ }]
160
+ }
161
+ }
162
+
163
+ ---
164
+
165
+ ### Add To Cart
166
+
167
+ Triggered when add to cart button is clicked
168
+
169
+ dataLayer:
170
+
171
+ 'event': 'addToCart',
172
+ 'ecommerce': {
173
+ 'add': {
174
+ 'products': [{
175
+ 'id': "4559F84840",
176
+ 'name': "Slim Ankle Pants",
177
+ 'category': "Women's Pants",
178
+ 'variant': "292205283-4",
179
+ 'price': 31.56,
180
+ 'quantity': 1
181
+ }]
182
+ }
183
+ }
184
+
185
+ ---
186
+
187
+ ### Remove From Cart
188
+
189
+ Triggered when a product is removed from the cart
190
+
191
+ dataLayer:
192
+
193
+ 'event': 'removeFromCart',
194
+ 'ecommerce': {
195
+ 'remove': {
196
+ 'products': [{
197
+ 'id': "4559F84840",
198
+ 'name': "Slim Ankle Pants",
199
+ 'category': "Women's Pants",
200
+ 'variant': "292205283-4",
201
+ 'price': 31.56,
202
+ 'quantity': 1
203
+ }]
204
+ }
205
+ }
206
+
207
+ ---
208
+
209
+ ### Cart View
210
+
211
+ Triggered when the cart page is opened, including cart summaries (drawer or dropdown)
212
+
213
+ Uses Checkout Step shared function
214
+
215
+ ---
216
+
217
+ ### Checkout Addresses View
218
+
219
+ Triggered on the Addresses step of checkout
220
+
221
+ Uses Checkout Step shared function
222
+
223
+ ---
224
+
225
+ ### Checkout Shipping View
226
+
227
+ Triggered on the Shipping step of checkout
228
+
229
+ Uses Checkout Step shared function
230
+
231
+ ---
232
+
233
+ ### Checkout Shipping Service Selected
234
+
235
+ Triggered when the user changes the shipping option on the Shipping step of checkout
236
+
237
+ dataLayer:
238
+
239
+ 'event': 'checkoutOption',
240
+ 'ecommerce': {
241
+ 'checkout_option': {
242
+ 'actionField': {'step': 4, 'option': 'FEDEX Ground'}
243
+ }
244
+ }
245
+
246
+ ---
247
+
248
+ ### Checkout Payment View
249
+
250
+ Triggered on the Payment step of checkout
251
+
252
+ Uses Checkout Step shared function
253
+
254
+ ---
255
+
256
+ ### Checkout Payment Selected
257
+
258
+ Triggered when the user changes the payment method on the Payment step of checkout
259
+
260
+ dataLayer:
261
+
262
+ 'event': 'checkoutOption',
263
+ 'ecommerce': {
264
+ 'checkout_option': {
265
+ 'actionField': {'step': 5, 'option': 'new_card'}
266
+ }
267
+ }
268
+
269
+ ---
270
+
271
+ ### Checkout Order Placed
272
+
273
+ Triggered on the order confirmation page of checkout
274
+
275
+ dataLayer:
276
+
277
+ 'ecommerce': {
278
+ 'purchase': {
279
+ 'actionField': {
280
+ 'id': 'CF6D17E28B',
281
+ 'affiliation': 'Site Name',
282
+ 'revenue': 39.50,
283
+ 'tax': 1.94,
284
+ 'shipping': 7.00,
285
+ 'coupon': 'promocode1, promocode2'
286
+ },
287
+ 'products': [
288
+ {
289
+ 'name': "Slim Ankle Pants",
290
+ 'id': "4559F84840",
291
+ 'price': 31.56,
292
+ 'category': "Women's Pants",
293
+ 'variant': "292205283-4",
294
+ 'quantity': 1
295
+ }
296
+ ]
297
+ }
298
+ }
299
+
300
+ ## Getting Started
301
+
302
+ This gem contains a rails engine that must be mounted onto a host Rails application.
303
+
304
+ You must have access to a WebLinc gems server to use this gem. Add your gems server credentials to Bundler:
305
+
306
+ bundle config gems.weblinc.com my_username:my_password
307
+
308
+ Or set the appropriate environment variable in a shell startup file:
309
+
310
+ export BUNDLE_GEMS__WEBLINC__COM='my_username:my_password'
311
+
312
+ Then add the gem to your application's Gemfile specifying the source:
313
+
314
+ # ...
315
+ gem 'workarea-google_tag_manager', source: 'https://gems.weblinc.com'
316
+ # ...
317
+
318
+ Or use a source block:
319
+
320
+ # ...
321
+ source 'https://gems.weblinc.com' do
322
+ gem 'workarea-google_tag_manager'
323
+ end
324
+ # ...
325
+
326
+ Update your application's bundle.
327
+
328
+ cd path/to/application
329
+ bundle
330
+
331
+ ## Workarea Platform Documentation
332
+
333
+ See [http://developer.weblinc.com](http://developer.weblinc.com) for Workarea platform documentation.
334
+
335
+ ## Copyright & Licensing
336
+
337
+ Copyright Workarea 2015. All rights reserved.
338
+
339
+ For licensing, contact sales@workarea.com.