govuk_publishing_components 35.1.1 → 35.2.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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-core.js +9 -4
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-link-tracker.js +18 -2
- data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +5 -2
- data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js +430 -313
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +2 -3
- data/app/controllers/govuk_publishing_components/component_guide_controller.rb +1 -1
- data/app/models/govuk_publishing_components/audit_applications.rb +5 -1
- data/app/models/govuk_publishing_components/audit_comparer.rb +4 -4
- data/app/views/govuk_publishing_components/audit/_applications.html.erb +22 -4
- data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +19 -5
- data/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +24 -4
- data/lib/govuk_publishing_components/presenters/component_wrapper_helper.rb +35 -12
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 972ee046b894a4166b8098b0fd68443fe83c9dd3ca990dc53df66943719bc3f8
|
4
|
+
data.tar.gz: fe06a9efe47489b88fe35088fe043cbf404683516ba709d9ec8192412749e2e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 788a0616987260f023d3c4b982e9ae7ca1150bdf996ed6001c7d999eb22116725b4a5ebaef2069ab23882fb4d1acbdb7c47d7f0686c1ef4bd171773de27da178
|
7
|
+
data.tar.gz: ee4d860cc7fcaa7e7f374edd761d4f513455b319efea4b1e115667ae8cef89c0fef815c46c00b9b0330eb511ce6d5822dea79877174dddc3e1c67cb9feac3182
|
@@ -230,13 +230,18 @@ window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {};
|
|
230
230
|
// Only index links that are not search results
|
231
231
|
if (!link.getAttribute('data-ga4-ecommerce-path')) {
|
232
232
|
totalLinks++
|
233
|
-
link.setAttribute('data-ga4-index', totalLinks)
|
233
|
+
link.setAttribute('data-ga4-index', '{"index_link": "' + totalLinks + '"}')
|
234
234
|
}
|
235
235
|
}
|
236
236
|
|
237
|
-
|
238
|
-
|
239
|
-
|
237
|
+
try {
|
238
|
+
var ga4LinkData = JSON.parse(module.getAttribute('data-ga4-link'))
|
239
|
+
ga4LinkData.index_total = totalLinks
|
240
|
+
module.setAttribute('data-ga4-link', JSON.stringify(ga4LinkData))
|
241
|
+
} catch (e) {
|
242
|
+
// if there's a problem with the config, don't start the tracker
|
243
|
+
console.error('Unable to JSON.parse or JSON.stringify index: ' + e.message, window.location)
|
244
|
+
}
|
240
245
|
},
|
241
246
|
|
242
247
|
// index is given as a string of the form 1.2.3 or 1.2
|
@@ -87,8 +87,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
87
87
|
data.link_path_parts = window.GOVUK.analyticsGa4.core.trackFunctions.populateLinkPathParts(data.url)
|
88
88
|
data.method = window.GOVUK.analyticsGa4.core.trackFunctions.getClickType(event)
|
89
89
|
data.external = window.GOVUK.analyticsGa4.core.trackFunctions.isExternalLink(data.url) ? 'true' : 'false'
|
90
|
-
data.index =
|
91
|
-
data.index = window.GOVUK.analyticsGa4.core.trackFunctions.createIndexObject(data.index)
|
90
|
+
data.index = this.setIndex(data.index, event.target)
|
92
91
|
|
93
92
|
if (data.type === 'smart answer' && data.action === 'change response') {
|
94
93
|
data.section = PIIRemover.stripPIIWithOverride(data.section, true, true)
|
@@ -108,5 +107,22 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
108
107
|
}
|
109
108
|
}
|
110
109
|
|
110
|
+
Ga4LinkTracker.prototype.setIndex = function (indexData, target) {
|
111
|
+
var index
|
112
|
+
|
113
|
+
if (target.getAttribute('data-ga4-index')) {
|
114
|
+
try {
|
115
|
+
index = JSON.parse(target.getAttribute('data-ga4-index'))
|
116
|
+
} catch (e) {
|
117
|
+
console.error('Unable to parse index as JSON: ' + e.message, window.location)
|
118
|
+
return
|
119
|
+
}
|
120
|
+
} else {
|
121
|
+
index = indexData || undefined
|
122
|
+
}
|
123
|
+
|
124
|
+
return window.GOVUK.analyticsGa4.core.trackFunctions.createIndexObject(index)
|
125
|
+
}
|
126
|
+
|
111
127
|
Modules.Ga4LinkTracker = Ga4LinkTracker
|
112
128
|
})(window.GOVUK.Modules)
|
@@ -196,8 +196,11 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
196
196
|
event_name: 'select_content',
|
197
197
|
type: 'step by step',
|
198
198
|
text: titleText.trim(),
|
199
|
-
index:
|
200
|
-
|
199
|
+
index: {
|
200
|
+
index_section: i + 1,
|
201
|
+
index_section_count: this.$module.totalSteps
|
202
|
+
},
|
203
|
+
index_total: thisel.querySelectorAll('a').length
|
201
204
|
}
|
202
205
|
|
203
206
|
var button = thisel.querySelector('.js-step-title-button')
|