govuk_publishing_components 40.1.0 → 41.0.0

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 (101) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/components/accordion.js +1 -79
  3. data/app/assets/javascripts/govuk_publishing_components/components/checkboxes.js +1 -34
  4. data/app/assets/javascripts/govuk_publishing_components/components/feedback.js +0 -17
  5. data/app/assets/javascripts/govuk_publishing_components/components/layout-super-navigation-header.js +0 -6
  6. data/app/assets/javascripts/govuk_publishing_components/components/single-page-notification-button.js +0 -7
  7. data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +8 -74
  8. data/app/assets/javascripts/govuk_publishing_components/dependencies.js +0 -4
  9. data/app/assets/javascripts/govuk_publishing_components/domain-config.js +0 -8
  10. data/app/assets/javascripts/govuk_publishing_components/lib/cookie-functions.js +0 -4
  11. data/app/assets/javascripts/govuk_publishing_components/lib/cookie-settings.js +0 -14
  12. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js +0 -20
  13. data/app/assets/javascripts/govuk_publishing_components/lib/toggle.js +0 -33
  14. data/app/assets/javascripts/govuk_publishing_components/load-analytics.js +0 -25
  15. data/app/views/govuk_publishing_components/components/_accordion.html.erb +1 -8
  16. data/app/views/govuk_publishing_components/components/_breadcrumbs.html.erb +1 -1
  17. data/app/views/govuk_publishing_components/components/_cards.html.erb +3 -11
  18. data/app/views/govuk_publishing_components/components/_contents_list.html.erb +2 -15
  19. data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +3 -19
  20. data/app/views/govuk_publishing_components/components/_details.html.erb +9 -11
  21. data/app/views/govuk_publishing_components/components/_image_card.html.erb +1 -5
  22. data/app/views/govuk_publishing_components/components/_intervention.html.erb +4 -4
  23. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +7 -21
  24. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +1 -26
  25. data/app/views/govuk_publishing_components/components/_metadata.html.erb +2 -5
  26. data/app/views/govuk_publishing_components/components/_organisation_logo.html.erb +2 -7
  27. data/app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb +0 -10
  28. data/app/views/govuk_publishing_components/components/_related_navigation.html.erb +1 -3
  29. data/app/views/govuk_publishing_components/components/_search.html.erb +0 -1
  30. data/app/views/govuk_publishing_components/components/_select.html.erb +1 -2
  31. data/app/views/govuk_publishing_components/components/_share_links.html.erb +1 -10
  32. data/app/views/govuk_publishing_components/components/_single_page_notification_button.html.erb +0 -1
  33. data/app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb +1 -1
  34. data/app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb +1 -24
  35. data/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +1 -14
  36. data/app/views/govuk_publishing_components/components/_subscription_links.html.erb +1 -4
  37. data/app/views/govuk_publishing_components/components/_translation_nav.html.erb +0 -1
  38. data/app/views/govuk_publishing_components/components/contextual_sidebar/_ukraine_cta.html.erb +1 -7
  39. data/app/views/govuk_publishing_components/components/docs/accordion.yml +1 -60
  40. data/app/views/govuk_publishing_components/components/docs/big_number.yml +2 -6
  41. data/app/views/govuk_publishing_components/components/docs/breadcrumbs.yml +0 -1
  42. data/app/views/govuk_publishing_components/components/docs/button.yml +1 -1
  43. data/app/views/govuk_publishing_components/components/docs/cards.yml +3 -13
  44. data/app/views/govuk_publishing_components/components/docs/checkboxes.yml +0 -33
  45. data/app/views/govuk_publishing_components/components/docs/cookie_banner.yml +2 -2
  46. data/app/views/govuk_publishing_components/components/docs/details.yml +0 -15
  47. data/app/views/govuk_publishing_components/components/docs/document_list.yml +11 -18
  48. data/app/views/govuk_publishing_components/components/docs/error_alert.yml +1 -1
  49. data/app/views/govuk_publishing_components/components/docs/govspeak.yml +0 -11
  50. data/app/views/govuk_publishing_components/components/docs/image_card.yml +0 -31
  51. data/app/views/govuk_publishing_components/components/docs/intervention.yml +0 -26
  52. data/app/views/govuk_publishing_components/components/docs/layout_for_public.yml +2 -2
  53. data/app/views/govuk_publishing_components/components/docs/meta_tags.yml +0 -2
  54. data/app/views/govuk_publishing_components/components/docs/option_select.yml +4 -16
  55. data/app/views/govuk_publishing_components/components/docs/organisation_logo.yml +0 -15
  56. data/app/views/govuk_publishing_components/components/docs/print_link.yml +2 -9
  57. data/app/views/govuk_publishing_components/components/docs/select.yml +0 -36
  58. data/app/views/govuk_publishing_components/components/docs/share_links.yml +2 -4
  59. data/app/views/govuk_publishing_components/components/docs/step_by_step_nav.yml +2 -25
  60. data/app/views/govuk_publishing_components/components/docs/step_by_step_nav_header.yml +0 -23
  61. data/app/views/govuk_publishing_components/components/docs/step_by_step_nav_related.yml +0 -10
  62. data/app/views/govuk_publishing_components/components/docs/subscription_links.yml +3 -15
  63. data/app/views/govuk_publishing_components/components/docs/table.yml +1 -1
  64. data/app/views/govuk_publishing_components/components/docs/tabs.yml +1 -1
  65. data/app/views/govuk_publishing_components/components/docs/translation_nav.yml +3 -27
  66. data/app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb +1 -5
  67. data/app/views/govuk_publishing_components/components/feedback/_survey_signup_form.html.erb +0 -2
  68. data/app/views/govuk_publishing_components/components/feedback/_yes_no_banner.html.erb +0 -10
  69. data/app/views/govuk_publishing_components/components/layout_header/_header_logo.html.erb +1 -1
  70. data/app/views/govuk_publishing_components/components/layout_header/_search.html.erb +0 -5
  71. data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +0 -7
  72. data/lib/govuk_publishing_components/presenters/breadcrumbs_helper.rb +1 -19
  73. data/lib/govuk_publishing_components/presenters/image_card_helper.rb +1 -15
  74. data/lib/govuk_publishing_components/presenters/public_layout_helper.rb +2 -24
  75. data/lib/govuk_publishing_components/presenters/select_helper.rb +0 -4
  76. data/lib/govuk_publishing_components/presenters/single_page_notification_button_helper.rb +0 -5
  77. data/lib/govuk_publishing_components/presenters/translation_nav_helper.rb +0 -7
  78. data/lib/govuk_publishing_components/version.rb +1 -1
  79. metadata +1 -23
  80. data/app/assets/javascripts/govuk_publishing_components/analytics/analytics.js +0 -92
  81. data/app/assets/javascripts/govuk_publishing_components/analytics/auto-scroll-tracker.js +0 -221
  82. data/app/assets/javascripts/govuk_publishing_components/analytics/auto-track-event.js +0 -30
  83. data/app/assets/javascripts/govuk_publishing_components/analytics/cross-domain-tracking.js +0 -55
  84. data/app/assets/javascripts/govuk_publishing_components/analytics/custom-dimensions.js +0 -133
  85. data/app/assets/javascripts/govuk_publishing_components/analytics/download-link-tracker.js +0 -46
  86. data/app/assets/javascripts/govuk_publishing_components/analytics/ecommerce.js +0 -101
  87. data/app/assets/javascripts/govuk_publishing_components/analytics/error-tracking.js +0 -51
  88. data/app/assets/javascripts/govuk_publishing_components/analytics/explicit-cross-domain-links.js +0 -88
  89. data/app/assets/javascripts/govuk_publishing_components/analytics/external-link-tracker.js +0 -68
  90. data/app/assets/javascripts/govuk_publishing_components/analytics/google-analytics-universal-tracker.js +0 -220
  91. data/app/assets/javascripts/govuk_publishing_components/analytics/init.js +0 -60
  92. data/app/assets/javascripts/govuk_publishing_components/analytics/linked-domains.js +0 -135
  93. data/app/assets/javascripts/govuk_publishing_components/analytics/mailto-link-tracker.js +0 -43
  94. data/app/assets/javascripts/govuk_publishing_components/analytics/page-content.js +0 -160
  95. data/app/assets/javascripts/govuk_publishing_components/analytics/pii.js +0 -115
  96. data/app/assets/javascripts/govuk_publishing_components/analytics/print-intent.js +0 -39
  97. data/app/assets/javascripts/govuk_publishing_components/analytics/static-analytics.js +0 -132
  98. data/app/assets/javascripts/govuk_publishing_components/analytics/track-click.js +0 -75
  99. data/app/assets/javascripts/govuk_publishing_components/analytics/track-select-change.js +0 -56
  100. data/app/assets/javascripts/govuk_publishing_components/analytics.js +0 -23
  101. data/app/assets/javascripts/govuk_publishing_components/components/details.js +0 -48
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c5fc5e9c02a30ad0e7d1d21d034da01775c4f1f5a2f2a40e4b5d0693dae48033
4
- data.tar.gz: 84697249d14727c29b934bf5fe9403f580711421da5f1b1172d1af734b8989b6
3
+ metadata.gz: e9ecd6d3b0b215006949226c1b78eb7b68f775b34e12e79fef923da49e96310d
4
+ data.tar.gz: 362a4fa295d01bcbd8a56690236160c9058776e7ec5d730b11dadfe5c5da32b3
5
5
  SHA512:
6
- metadata.gz: d9b3f9730f1636e7a5ae8f78227fd96ba87ba5f4365c1f6f624c4383be524a68aa414ba6091cdda40e46db5cfd9bb3fb7c695598dec75260a95417b89e96ac35
7
- data.tar.gz: ecd0031c1d3a84d47cebc523bf34fc80554f12a843a3864b9ca1c05641380d8c1044532c876cf8f70cbb16665ba448438594c25e107334fe5c11161a5f33f5c4
6
+ metadata.gz: 6bcbbd412cd4247af43891bc0f41b1d1c1484f6a7dcc4a9bd59f507cdcb7bb64c70aab383ad9ea3538ad7007828bd2e9b900b9840de3cb2d8d97c34822db933c
7
+ data.tar.gz: 247e5643e44d4dd298f684afafe8a1aee2f57340b6fa51099a996d2df99ae0aaaba2853ce4137e80cad1184c071c28f9342efd2d2aea3bb3dabad78f0c45eaa7
@@ -35,30 +35,6 @@ window.GOVUK.Modules.GovukAccordion = window.GOVUKFrontend.Accordion;
35
35
  this.openByAnchorOnLoad()
36
36
  this.addEventListenersForAnchors()
37
37
  }
38
- // Feature flag for "Show all sections" GA click event tracking
39
- if (this.$module.getAttribute('data-track-show-all-clicks') === 'true') {
40
- this.addAccordionOpenAllTracking()
41
- }
42
- // Feature flag for each section GA click event tracking
43
- if (this.$module.getAttribute('data-track-sections') === 'true') {
44
- this.addEventListenerSections()
45
- }
46
-
47
- // look for data attributes to put onto the 'show/hide all' link
48
- var showAllAttributes = this.$module.getAttribute('data-show-all-attributes')
49
- var showAll
50
- if (showAllAttributes) {
51
- try {
52
- showAll = this.$module.querySelector(this.showAllControls)
53
- var values = JSON.parse(showAllAttributes)
54
- var keys = Object.keys(values)
55
- for (var i = 0; i < keys.length; i++) {
56
- showAll.setAttribute('data-' + keys[i], values[keys[i]])
57
- }
58
- } catch (e) {
59
- console.error('Could not read accordion data attributes error: ' + e.message, window.location)
60
- }
61
- }
62
38
 
63
39
  // if GA4 is enabled, set attributes on 'show all sections' for tracking using ga4-event-tracker
64
40
  var dataModule = this.$module.getAttribute('data-module')
@@ -66,7 +42,7 @@ window.GOVUK.Modules.GovukAccordion = window.GOVUKFrontend.Accordion;
66
42
  if (isGa4Enabled) {
67
43
  var indexTotal = this.$module.querySelectorAll('.govuk-accordion__section').length
68
44
  var showAllAttributesGa4 = { event_name: 'select_content', type: 'accordion', index_section: 0, index_section_count: indexTotal }
69
- showAll = this.$module.querySelector(this.showAllControls)
45
+ var showAll = this.$module.querySelector(this.showAllControls)
70
46
  showAll.setAttribute('data-ga4-event', JSON.stringify(showAllAttributesGa4))
71
47
  }
72
48
  }
@@ -126,59 +102,5 @@ window.GOVUK.Modules.GovukAccordion = window.GOVUKFrontend.Accordion;
126
102
  }
127
103
  }
128
104
 
129
- // To track the Accordion's "Show all sections" / "Hide all sections" button click events and pass them to the GA event tracking
130
- GemAccordion.prototype.addAccordionOpenAllTracking = function () {
131
- this.$module.querySelector(this.showAllControls).addEventListener('click', function (event) {
132
- var expanded = event.target.getAttribute('aria-expanded') === 'true'
133
- var label = expanded ? 'Show all sections' : 'Hide all sections'
134
- var action = expanded ? 'accordionOpened' : 'accordionClosed'
135
- var options = { transport: 'beacon', label: label }
136
-
137
- var extraOptions = event.target && event.target.getAttribute('data-track-options')
138
-
139
- // this uses the same logic as track-click.js handleClick
140
- // means we can add a custom dimensions on click
141
- if (extraOptions) {
142
- extraOptions = JSON.parse(extraOptions)
143
- for (var k in extraOptions) options[k] = extraOptions[k]
144
- }
145
-
146
- if (window.GOVUK.analytics && window.GOVUK.analytics.trackEvent) {
147
- window.GOVUK.analytics.trackEvent('pageElementInteraction', action, options)
148
- }
149
- })
150
- }
151
-
152
- GemAccordion.prototype.addEventListenerSections = function () {
153
- var sections = this.$module.querySelectorAll(this.sectionButton)
154
- for (var section of sections) {
155
- section.addEventListener('click', this.addAccordionSectionTracking.bind(this, section))
156
- }
157
- }
158
-
159
- // If the Accordion's sections are opened on click, then pass them to the GA event tracking
160
- GemAccordion.prototype.addAccordionSectionTracking = function (section) {
161
- var expanded = section.getAttribute('aria-expanded') === 'false'
162
- var label = section.querySelector(this.headingText).textContent
163
- var action = expanded ? 'accordionOpened' : 'accordionClosed'
164
- var options = { transport: 'beacon', label: label }
165
-
166
- // optional parameters are added to the parent
167
- // heading not the button that is clicked
168
- var extraOptions = section.parentElement && section.parentElement.getAttribute('data-track-options')
169
-
170
- // this uses the same logic as track-click.js handleClick
171
- // means we can add a custom dimensions on click
172
- // (such as the index of the accordion on the page)
173
- if (extraOptions) {
174
- extraOptions = JSON.parse(extraOptions)
175
- for (var k in extraOptions) options[k] = extraOptions[k]
176
- }
177
-
178
- if (window.GOVUK.analytics && window.GOVUK.analytics.trackEvent) {
179
- window.GOVUK.analytics.trackEvent('pageElementInteraction', action, options)
180
- }
181
- }
182
-
183
105
  Modules.GemAccordion = GemAccordion
184
106
  })(window.GOVUK.Modules)
@@ -13,44 +13,11 @@ window.GOVUK.Modules.GovukCheckboxes = window.GOVUKFrontend.Checkboxes;
13
13
  GemCheckboxes.prototype.init = function () {
14
14
  this.applyAriaControlsAttributes(this.$module)
15
15
 
16
- for (var i = 0; i < this.$checkboxes.length; i++) {
17
- this.$checkboxes[i].addEventListener('change', this.handleCheckboxChange)
18
- }
19
-
20
- for (i = 0; i < this.$nestedCheckboxes.length; i++) {
16
+ for (var i = 0; i < this.$nestedCheckboxes.length; i++) {
21
17
  this.$nestedCheckboxes[i].addEventListener('change', this.handleNestedCheckboxChange.bind(this))
22
18
  }
23
19
  }
24
20
 
25
- GemCheckboxes.prototype.handleCheckboxChange = function (event) {
26
- if (window.GOVUK.analytics && window.GOVUK.analytics.trackEvent) {
27
- // Where checkboxes are manipulated externally in finders, `suppressAnalytics`
28
- // is passed to prevent duplicate GA events.
29
- // use Oliver Steele's Nested Object Access Pattern https://hackernoon.com/accessing-nested-objects-in-javascript-f02f1bd6387f
30
- var allowAnalytics = ((event || {}).detail || {}).suppressAnalytics !== true
31
- if (allowAnalytics) {
32
- var $checkbox = event.target
33
- var category = $checkbox.getAttribute('data-track-category')
34
- if (category) {
35
- var uncheckTrackCategory = $checkbox.getAttribute('data-uncheck-track-category')
36
- if (!$checkbox.checked && uncheckTrackCategory) {
37
- category = uncheckTrackCategory
38
- }
39
- var action = $checkbox.getAttribute('data-track-action')
40
- var options = $checkbox.getAttribute('data-track-options')
41
- if (options) {
42
- options = JSON.parse(options)
43
- } else {
44
- options = {}
45
- }
46
- options.value = $checkbox.getAttribute('data-track-value')
47
- options.label = $checkbox.getAttribute('data-track-label')
48
- window.GOVUK.analytics.trackEvent(category, action, options)
49
- }
50
- }
51
- }
52
- }
53
-
54
21
  GemCheckboxes.prototype.handleNestedCheckboxChange = function (event) {
55
22
  var $checkbox = event.target
56
23
  var $isNested = $checkbox.closest('.govuk-checkboxes--nested')
@@ -38,7 +38,6 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
38
38
  e.preventDefault()
39
39
  var el = e.target.closest('button')
40
40
  this.toggleForm(el.getAttribute('aria-controls'))
41
- this.trackEvent(this.getTrackEventParams(el))
42
41
  this.updateAriaAttributes(el)
43
42
  }.bind(this))
44
43
  }
@@ -50,7 +49,6 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
50
49
  var el = e.target
51
50
  var formToToggle = el.getAttribute('aria-controls')
52
51
  this.toggleForm(formToToggle)
53
- this.trackEvent(this.getTrackEventParams(el))
54
52
  this.setInitialAriaAttributes()
55
53
  this.revealInitialPrompt()
56
54
  var refocusClass = '.js-' + formToToggle
@@ -60,7 +58,6 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
60
58
 
61
59
  this.pageIsUsefulButton.addEventListener('click', function (e) {
62
60
  e.preventDefault()
63
- this.trackEvent(this.getTrackEventParams(this.pageIsUsefulButton))
64
61
  this.showFormSuccess()
65
62
  this.revealInitialPrompt()
66
63
  }.bind(this))
@@ -87,7 +84,6 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
87
84
 
88
85
  this.done = function () {
89
86
  if (xhr.status === 200) {
90
- this.trackEvent(this.getTrackEventParams($form))
91
87
  this.showFormSuccess(xhr.message)
92
88
  this.revealInitialPrompt()
93
89
  this.setInitialAriaAttributes()
@@ -186,19 +182,6 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
186
182
  }
187
183
  }
188
184
 
189
- Feedback.prototype.getTrackEventParams = function ($node) {
190
- return {
191
- category: $node.getAttribute('data-track-category'),
192
- action: $node.getAttribute('data-track-action')
193
- }
194
- }
195
-
196
- Feedback.prototype.trackEvent = function (trackEventParams) {
197
- if (window.GOVUK.analytics && window.GOVUK.analytics.trackEvent) {
198
- window.GOVUK.analytics.trackEvent(trackEventParams.category, trackEventParams.action)
199
- }
200
- }
201
-
202
185
  Feedback.prototype.showError = function (error) {
203
186
  var genericError = [
204
187
  '<h2>Sorry, we’re unable to receive your message right now.</h2>',
@@ -38,17 +38,11 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
38
38
 
39
39
  var toggle = function ($button, $menu) {
40
40
  var isOpen = $button.getAttribute('aria-expanded') === 'true'
41
- var trackingLabel = $button.getAttribute('data-tracking-key')
42
41
  if (isOpen) {
43
42
  hide($button, $menu)
44
43
  } else {
45
44
  show($button, $menu)
46
45
  }
47
-
48
- // Fire analytics if analytics are available
49
- if (window.GOVUK.analytics && window.GOVUK.analytics.trackEvent && trackingLabel) {
50
- window.GOVUK.analytics.trackEvent('headerClicked', trackingLabel + (isOpen ? 'Closed' : 'Opened'), { label: 'none' })
51
- }
52
46
  }
53
47
 
54
48
  // Clicking an element inside a `button` element causes the `event.target` to
@@ -37,19 +37,12 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
37
37
  // Only set custom button text if both text items are provided
38
38
  var customText = customSubscribeText && customUnsubscribeText
39
39
 
40
- // Append '-[button-location]' to the tracking data attribute value if data-button-location is set
41
- var optionalButtonLocation = this.$module.getAttribute('data-button-location') ? '-' + this.$module.getAttribute('data-button-location') : ''
42
-
43
40
  // If response returns active, user has subscribed to notifications
44
41
  if (active === true) {
45
- this.$module.setAttribute('data-track-action', 'Unsubscribe-button' + optionalButtonLocation)
46
-
47
42
  if (customText) {
48
43
  this.$module.querySelector('.gem-c-single-page-notication-button__text').textContent = customUnsubscribeText
49
44
  }
50
45
  } else {
51
- this.$module.setAttribute('data-track-action', 'Subscribe-button' + optionalButtonLocation)
52
-
53
46
  if (customText) {
54
47
  this.$module.querySelector('.gem-c-single-page-notication-button__text').textContent = customSubscribeText
55
48
  }
@@ -43,8 +43,6 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
43
43
  this.$module.sessionStoreLink = this.$module.sessionStoreLink + '_' + this.$module.uniqueId
44
44
  }
45
45
 
46
- var stepNavTracker = new this.StepNavTracker(this.$module.uniqueId, this.$module.totalSteps, this.$module.totalLinks)
47
-
48
46
  this.getTextForInsertedElements()
49
47
  this.addButtonstoSteps()
50
48
  this.addShowHideAllButton()
@@ -54,9 +52,9 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
54
52
  this.ensureOnlyOneActiveLink()
55
53
  this.showPreviouslyOpenedSteps()
56
54
 
57
- this.bindToggleForSteps(stepNavTracker)
58
- this.bindToggleShowHideAllButton(stepNavTracker)
59
- this.bindComponentLinkClicks(stepNavTracker)
55
+ this.bindToggleForSteps()
56
+ this.bindToggleShowHideAllButton()
57
+ this.bindComponentLinkClicks()
60
58
  }
61
59
 
62
60
  Gemstepnav.prototype.getTextForInsertedElements = function () {
@@ -207,19 +205,14 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
207
205
  }
208
206
  }
209
207
 
210
- Gemstepnav.prototype.bindToggleForSteps = function (stepNavTracker) {
208
+ Gemstepnav.prototype.bindToggleForSteps = function () {
211
209
  var that = this
212
210
  var togglePanels = this.$module.querySelectorAll('.js-toggle-panel')
213
211
 
214
212
  for (var i = 0; i < togglePanels.length; i++) {
215
- togglePanels[i].addEventListener('click', function (event) {
213
+ togglePanels[i].addEventListener('click', function () {
216
214
  var stepView = new that.StepView(this.parentNode, that.$module)
217
215
  stepView.toggle()
218
-
219
- var stepIsOptional = this.parentNode.hasAttribute('data-optional')
220
- var toggleClick = new that.StepToggleClick(event, stepView, stepNavTracker, stepIsOptional, that.$module.stepNavSize)
221
- toggleClick.trackClick()
222
-
223
216
  that.setShowHideAllText()
224
217
  that.rememberStepState(this.parentNode)
225
218
  })
@@ -246,16 +239,13 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
246
239
  }
247
240
  }
248
241
 
249
- // tracking click events on links in step content
250
- Gemstepnav.prototype.bindComponentLinkClicks = function (stepNavTracker) {
242
+ Gemstepnav.prototype.bindComponentLinkClicks = function () {
251
243
  var jsLinks = this.$module.querySelectorAll('.js-link')
252
244
  var that = this
253
245
 
254
246
  for (var i = 0; i < jsLinks.length; i++) {
255
247
  jsLinks[i].addEventListener('click', function (event) {
256
248
  var dataPosition = this.getAttribute('data-position')
257
- var linkClick = new that.ComponentLinkClick(event, stepNavTracker, dataPosition, that.$module.stepNavSize)
258
- linkClick.trackClick()
259
249
 
260
250
  if (this.getAttribute('rel') !== 'external') {
261
251
  that.saveToSessionStorage(that.$module.sessionStoreLink, dataPosition)
@@ -353,18 +343,13 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
353
343
  }
354
344
  }
355
345
 
356
- Gemstepnav.prototype.bindToggleShowHideAllButton = function (stepNavTracker) {
346
+ Gemstepnav.prototype.bindToggleShowHideAllButton = function () {
357
347
  var that = this
358
348
 
359
349
  this.$module.showOrHideAllButton.addEventListener('click', function (event) {
360
350
  var textContent = this.textContent || this.innerText
361
351
  var shouldShowAll = textContent === that.$module.actions.showAllText
362
352
 
363
- // Fire GA click tracking
364
- stepNavTracker.trackClick('pageElementInteraction', (shouldShowAll ? 'stepNavAllShown' : 'stepNavAllHidden'), {
365
- label: (shouldShowAll ? that.$module.actions.showAllText : that.$module.actions.hideAllText) + ': ' + that.$module.stepNavSize
366
- })
367
-
368
353
  that.setAllStepsShownState(shouldShowAll)
369
354
  that.$module.showOrHideAllButton.setAttribute('aria-expanded', shouldShowAll)
370
355
  that.setShowHideAllText()
@@ -445,30 +430,16 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
445
430
  }
446
431
  }
447
432
 
448
- Gemstepnav.prototype.StepToggleClick = function (event, stepView, stepNavTracker, stepIsOptional, stepNavSize) {
433
+ Gemstepnav.prototype.StepToggleClick = function (event, stepView, stepIsOptional, stepNavSize) {
449
434
  this.target = event.target
450
435
  this.stepIsOptional = stepIsOptional
451
436
  this.stepNavSize = stepNavSize
452
437
 
453
- this.trackClick = function () {
454
- var trackingOptions = { label: this.trackingLabel(), dimension28: stepView.numberOfContentItems().toString() }
455
- stepNavTracker.trackClick('pageElementInteraction', this.trackingAction(), trackingOptions)
456
- }
457
-
458
- this.trackingLabel = function () {
459
- var clickedNearbyToggle = this.target.closest('.js-step').querySelectorAll('.js-toggle-panel')[0]
460
- return clickedNearbyToggle.getAttribute('data-position') + ' - ' + stepView.title + ' - ' + this.locateClickElement() + ': ' + this.stepNavSize + this.isOptional()
461
- }
462
-
463
438
  // returns index of the clicked step in the overall number of steps
464
439
  this.stepIndex = function () { // eslint-disable-line no-unused-vars
465
440
  return this.$module.steps.index(stepView.element) + 1
466
441
  }
467
442
 
468
- this.trackingAction = function () {
469
- return (stepView.isHidden() ? 'stepNavHidden' : 'stepNavShown')
470
- }
471
-
472
443
  this.locateClickElement = function () {
473
444
  if (this.clickedOnIcon()) {
474
445
  return this.iconType() + ' click'
@@ -496,42 +467,5 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
496
467
  }
497
468
  }
498
469
 
499
- Gemstepnav.prototype.ComponentLinkClick = function (event, stepNavTracker, linkPosition, size) {
500
- this.size = size
501
- this.target = event.target
502
-
503
- this.trackClick = function () {
504
- var trackingOptions = { label: this.target.getAttribute('href') + ' : ' + this.size }
505
- var dimension28 = this.target.closest('.gem-c-step-nav__list').getAttribute('data-length')
506
-
507
- if (dimension28) {
508
- trackingOptions.dimension28 = dimension28
509
- }
510
-
511
- stepNavTracker.trackClick('stepNavLinkClicked', linkPosition, trackingOptions)
512
- }
513
- }
514
-
515
- // A helper that sends a custom event request to Google Analytics if
516
- // the GOVUK module is setup
517
- Gemstepnav.prototype.StepNavTracker = function (uniqueId, totalSteps, totalLinks) {
518
- this.totalSteps = totalSteps
519
- this.totalLinks = totalLinks
520
- this.uniqueId = uniqueId
521
-
522
- this.trackClick = function (category, action, options) {
523
- // dimension26 records the total number of expand/collapse steps in this step nav
524
- // dimension27 records the total number of links in this step nav
525
- // dimension28 records the number of links in the step that was shown/hidden (handled in click event)
526
- if (window.GOVUK.analytics && window.GOVUK.analytics.trackEvent) {
527
- options = options || {}
528
- options.dimension26 = options.dimension26 || this.totalSteps.toString()
529
- options.dimension27 = options.dimension27 || this.totalLinks.toString()
530
- options.dimension96 = options.dimension96 || this.uniqueId
531
- window.GOVUK.analytics.trackEvent(category, action, options)
532
- }
533
- }
534
- }
535
-
536
470
  Modules.Gemstepnav = Gemstepnav
537
471
  })(window.GOVUK.Modules)
@@ -6,7 +6,6 @@
6
6
 
7
7
  document.addEventListener('DOMContentLoaded', function () {
8
8
  window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {}
9
- window.GOVUK.analyticsVars = window.GOVUK.analyticsVars || {}
10
9
 
11
10
  // if statements ensure these functions don't execute during testing
12
11
  if (typeof window.GOVUK.loadAnalytics !== 'undefined') {
@@ -14,9 +13,6 @@ document.addEventListener('DOMContentLoaded', function () {
14
13
  if (typeof window.GOVUK.analyticsGa4.vars === 'undefined') {
15
14
  window.GOVUK.loadAnalytics.loadGa4()
16
15
  }
17
- if (typeof window.GOVUK.analyticsVars.gaProperty === 'undefined') {
18
- window.GOVUK.loadAnalytics.loadUa()
19
- }
20
16
  }
21
17
 
22
18
  window.GOVUK.modules.start()
@@ -14,8 +14,6 @@ window.GOVUK.vars.domains = [
14
14
  id: 'GTM-MG7HG5W',
15
15
  auth: 'bRiZ-jiEHtw6hHpGd6dF9w',
16
16
  preview: 'env-3',
17
- gaProperty: 'UA-UNSET',
18
- gaPropertyCrossDomain: 'UA-UNSET',
19
17
  consentApiUrl: 'staging'
20
18
  },
21
19
  {
@@ -27,8 +25,6 @@ window.GOVUK.vars.domains = [
27
25
  ],
28
26
  initialiseGA4: true,
29
27
  id: 'GTM-MG7HG5W',
30
- gaProperty: 'UA-26179049-1',
31
- gaPropertyCrossDomain: 'UA-145652997-1',
32
28
  consentApiUrl: 'production'
33
29
  },
34
30
  {
@@ -42,8 +38,6 @@ window.GOVUK.vars.domains = [
42
38
  id: 'GTM-MG7HG5W',
43
39
  auth: 'oJWs562CxSIjZKn_GlB5Bw',
44
40
  preview: 'env-5',
45
- gaProperty: 'UA-26179049-20',
46
- gaPropertyCrossDomain: 'UA-145652997-1',
47
41
  consentApiUrl: 'staging'
48
42
  },
49
43
  {
@@ -57,8 +51,6 @@ window.GOVUK.vars.domains = [
57
51
  id: 'GTM-MG7HG5W',
58
52
  auth: 'C7iYdcsOlYgGmiUJjZKrHQ',
59
53
  preview: 'env-4',
60
- gaProperty: 'UA-26179049-22',
61
- gaPropertyCrossDomain: 'UA-145652997-1',
62
54
  consentApiUrl: 'staging'
63
55
  },
64
56
  {
@@ -25,11 +25,7 @@
25
25
  global_bar_seen: 'settings',
26
26
  govuk_browser_upgrade_dismisssed: 'settings',
27
27
  govuk_not_first_visit: 'settings',
28
- analytics_next_page_call: 'usage',
29
28
  user_nation: 'settings',
30
- _ga: 'usage',
31
- _gid: 'usage',
32
- _gat: 'usage',
33
29
  'JS-Detection': 'usage',
34
30
  TLSversion: 'usage',
35
31
  _ga_VBLT2V3FZR: 'usage', // gtag cookie used to persist the session state, integration
@@ -77,24 +77,10 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
77
77
  window.GOVUK.setCookie('cookies_preferences_set', true, { days: 365 })
78
78
  }
79
79
 
80
- this.fireAnalyticsEvent(options)
81
80
  this.showConfirmationMessage()
82
81
  return false
83
82
  }
84
83
 
85
- CookieSettings.prototype.fireAnalyticsEvent = function (consent) {
86
- var eventLabel = ''
87
-
88
- for (var option in consent) {
89
- var optionValue = consent[option] ? 'yes' : 'no'
90
- eventLabel += option + '-' + optionValue + ' '
91
- }
92
-
93
- if (window.GOVUK.analytics && window.GOVUK.analytics.trackEvent) {
94
- window.GOVUK.analytics.trackEvent('cookieSettings', 'Save changes', { label: eventLabel })
95
- }
96
- }
97
-
98
84
  CookieSettings.prototype.showConfirmationMessage = function () {
99
85
  var confirmationMessage = document.querySelector('div[data-cookie-confirmation]')
100
86
  // hide the message if already visible so assistive tech is triggered when it appears
@@ -28,18 +28,10 @@
28
28
  for (var i = 0; i < $youtubeLinks.length; ++i) {
29
29
  var $link = $youtubeLinks[i]
30
30
  var href = $link.getAttribute('href')
31
- var hasTracking = $link.hasAttribute('data-youtube-player-analytics')
32
31
  var options = {
33
32
  link: $link
34
33
  }
35
34
 
36
- if (hasTracking) {
37
- options.tracking = {
38
- hasTracking: hasTracking,
39
- category: $link.getAttribute('data-youtube-player-analytics-category')
40
- }
41
- }
42
-
43
35
  if (href.indexOf('/live_stream') >= 0) {
44
36
  var channelId = YoutubeLinkEnhancement.parseLivestream(href)
45
37
 
@@ -122,7 +114,6 @@
122
114
  },
123
115
  onStateChange: function (event) {
124
116
  var eventData = event.data
125
- var eventTarget = event.target
126
117
  var states = {
127
118
  /* eslint-disable quote-props */
128
119
  '-1': 'VideoUnstarted',
@@ -133,17 +124,6 @@
133
124
  '5': 'VideoCued'
134
125
  /* eslint-enable */
135
126
  }
136
- if (states[eventData] && options.tracking && options.tracking.hasTracking &&
137
- window.GOVUK.analytics && window.GOVUK.analytics.trackEvent) {
138
- var tracking = {
139
- category: options.tracking.category,
140
- action: states[eventData],
141
- label: { transport: 'beacon', label: eventTarget.getVideoData && eventTarget.getVideoData().title }
142
- }
143
-
144
- window.GOVUK.analytics.trackEvent(tracking.category, tracking.action, tracking.label)
145
- }
146
-
147
127
  if (window.GOVUK.analyticsGa4.analyticsModules.VideoTracker) {
148
128
  window.GOVUK.analyticsGa4.analyticsModules.VideoTracker.trackVideo(event, states[eventData])
149
129
  }
@@ -66,22 +66,6 @@
66
66
 
67
67
  `data-controls` can contain more than one element, space
68
68
  separated.
69
-
70
- With tracking:
71
-
72
- <div data-module="gem-toggle">
73
- <a href="#" data-controls="target6" data-expanded="true" data-track-category="category" data-track-action="action" data-toggled-text="Show more">
74
- Show less
75
- </a>
76
- <div id="target6">
77
- Content shown on page load, tracked when expanded and collapsed
78
- </div>
79
- </div>
80
-
81
- Use `data-track-category` and `data-track-action` together
82
- to enable analytics on the element. The track label will be
83
- determined based on the text present within the element
84
- at the time it was clicked.
85
69
  */
86
70
  window.GOVUK = window.GOVUK || {}
87
71
  window.GOVUK.Modules = window.GOVUK.Modules || {};
@@ -96,14 +80,6 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
96
80
 
97
81
  if (this.$module.toggleTrigger) {
98
82
  this.$module.toggleClass = this.$module.getAttribute('data-toggle-class') || 'js-hidden'
99
-
100
- this.$module.isTrackable = this.$module.toggleTrigger.hasAttribute('data-track-category') && this.$module.toggleTrigger.hasAttribute('data-track-action')
101
-
102
- if (this.$module.isTrackable) {
103
- this.$module.trackCategory = this.$module.toggleTrigger.getAttribute('data-track-category')
104
- this.$module.trackAction = this.$module.toggleTrigger.getAttribute('data-track-action')
105
- }
106
-
107
83
  this.addAriaAttrs()
108
84
  this.toggleOnClick()
109
85
  }
@@ -156,17 +132,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
156
132
  this.setAttribute('data-toggled-text', this.innerText)
157
133
  this.innerText = toggledText
158
134
  }
159
-
160
- if (window.GOVUK.analytics && window.GOVUK.analytics.trackEvent && that.$module.isTrackable) {
161
- that.track()
162
- }
163
135
  })
164
136
  }
165
137
 
166
- GemToggle.prototype.track = function () {
167
- var options = { label: this.$module.toggleTrigger.getAttribute('data-toggled-text') || this.$module.toggleTrigger.innerText }
168
- window.GOVUK.analytics.trackEvent(this.$module.trackCategory, this.$module.trackAction, options)
169
- }
170
-
171
138
  Modules.GemToggle = GemToggle
172
139
  })(window.GOVUK.Modules)
@@ -1,6 +1,4 @@
1
- //= require govuk_publishing_components/analytics
2
1
  //= require govuk_publishing_components/analytics-ga4
3
- //= require govuk_publishing_components/analytics/linked-domains
4
2
  //= require govuk_publishing_components/domain-config
5
3
 
6
4
  window.GOVUK.loadAnalytics = {
@@ -10,29 +8,6 @@ window.GOVUK.loadAnalytics = {
10
8
  }
11
9
  },
12
10
 
13
- // For Universal Analytics' cross domain tracking. linkedDomains is defined by the require statement at the top of the file.
14
- linkedDomains: window.GOVUK.analytics.linkedDomains,
15
-
16
- loadUa: function (currentDomain) {
17
- currentDomain = currentDomain || window.location.hostname
18
-
19
- // Universal Analytics variables
20
- window.GOVUK.analyticsVars = window.GOVUK.analyticsVars || {}
21
- window.GOVUK.analyticsVars.primaryLinkedDomains = ['account.gov.uk']
22
- window.GOVUK.analyticsVars.linkedDomains = this.linkedDomains
23
- window.GOVUK.analyticsVars.gaProperty = 'UA-UNSET'
24
- window.GOVUK.analyticsVars.gaPropertyCrossDomain = 'UA-UNSET'
25
-
26
- for (var i = 0; i < window.GOVUK.vars.domains.length; i++) {
27
- var current = window.GOVUK.vars.domains[i]
28
- if (this.arrayContains(currentDomain, current.domains)) {
29
- window.GOVUK.analyticsVars.gaProperty = current.gaProperty
30
- window.GOVUK.analyticsVars.gaPropertyCrossDomain = current.gaPropertyCrossDomain
31
- break
32
- }
33
- }
34
- },
35
-
36
11
  loadGa4: function (currentDomain) {
37
12
  currentDomain = currentDomain || window.location.hostname
38
13
  var environment = this.getEnvironment(currentDomain)
@@ -8,10 +8,7 @@
8
8
  id ||= "default-id-#{SecureRandom.hex(4)}"
9
9
  items ||= []
10
10
  anchor_navigation ||= false
11
- track_show_all_clicks ||= false
12
- track_sections ||= false
13
11
  disable_ga4 ||= false
14
- data_attributes_show_all ||= nil
15
12
 
16
13
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
17
14
  component_helper.set_id(id)
@@ -22,9 +19,6 @@
22
19
  component_helper.add_data_attribute({ module: "ga4-event-tracker" }) unless disable_ga4
23
20
  component_helper.add_data_attribute({ ga4_expandable: "" }) unless disable_ga4
24
21
  component_helper.add_data_attribute({ anchor_navigation: anchor_navigation }) if anchor_navigation
25
- component_helper.add_data_attribute({ track_show_all_clicks: track_show_all_clicks }) if track_show_all_clicks
26
- component_helper.add_data_attribute({ track_sections: track_sections }) if track_sections
27
- component_helper.add_data_attribute({ show_all_attributes: data_attributes_show_all }) if data_attributes_show_all
28
22
  component_helper.add_data_attribute(accordion_helper.apply_translations)
29
23
  %>
30
24
  <% if items.any? %>
@@ -51,8 +45,7 @@
51
45
  }.to_json
52
46
 
53
47
  # These attributes have been created separately from the item[:data_attributes]
54
- # object in order to keep them from colliding with GA4 event tracking and UA
55
- # tracking attributes
48
+ # object in order to keep them from colliding with GA4 event tracking attributes
56
49
  ga4_link_data_attributes = {}
57
50
  ga4_link_data_attributes[:module] = "ga4-link-tracker"
58
51
  ga4_link_data_attributes[:ga4_track_links_only] = ""