govuk_publishing_components 35.15.1 → 35.15.2
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 +11 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-event-tracker.js +1 -1
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-link-tracker.js +11 -9
- data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js +6 -8
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e84a39ca858aeb5f82b99db7e36787fcb9de0789d216a01ae705edc8b6412e50
|
|
4
|
+
data.tar.gz: cd621c972ba4b393cd8ca2921a43e45101dcdd1330c5d1dc80eee74b11ac1556
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ac457ab2307e9a0c5e38b494b54268c34113521a93e25d1d0bc99378b075b8ae8a9a3ba4477a6dc7249fc58e1d42be51600f3746019109eff8b31460d3ae8a6d
|
|
7
|
+
data.tar.gz: 8369bcf1d142762cd85e4c5e9a483560b1e904071dd73e500407c8abfffa692cc7f60745debae002861850a08a170a1fbc90c5b0ae7f72abe972e5ba089de898
|
|
@@ -205,6 +205,10 @@ window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {};
|
|
|
205
205
|
}
|
|
206
206
|
},
|
|
207
207
|
|
|
208
|
+
getPathname: function () {
|
|
209
|
+
return window.location.pathname
|
|
210
|
+
},
|
|
211
|
+
|
|
208
212
|
getProtocol: function () {
|
|
209
213
|
return window.location.protocol
|
|
210
214
|
},
|
|
@@ -252,6 +256,13 @@ window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {};
|
|
|
252
256
|
|
|
253
257
|
applyRedactionIfRequired: function (PIIRemover, element, data) {
|
|
254
258
|
return element.closest('[data-ga4-do-not-redact]') ? data : PIIRemover.stripPIIWithOverride(data, true, true)
|
|
259
|
+
},
|
|
260
|
+
|
|
261
|
+
appendPathToAnchorLinks: function (url) {
|
|
262
|
+
if (!this.stringStartsWith(url, '#') || this.getPathname() === '/') {
|
|
263
|
+
return url
|
|
264
|
+
}
|
|
265
|
+
return this.getPathname() + url
|
|
255
266
|
}
|
|
256
267
|
},
|
|
257
268
|
|
|
@@ -74,7 +74,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
|
74
74
|
if (aTag) {
|
|
75
75
|
var href = aTag.getAttribute('href')
|
|
76
76
|
if (href) {
|
|
77
|
-
schema.event_data.url = href
|
|
77
|
+
schema.event_data.url = window.GOVUK.analyticsGa4.core.trackFunctions.appendPathToAnchorLinks(href)
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
}
|
|
@@ -62,13 +62,13 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
|
62
62
|
|
|
63
63
|
Ga4LinkTracker.prototype.trackClick = function (event) {
|
|
64
64
|
var element = event.target
|
|
65
|
-
|
|
65
|
+
var trackFunctions = window.GOVUK.analyticsGa4.core.trackFunctions
|
|
66
66
|
// don't track this link if it's already being tracked by the ecommerce tracker
|
|
67
67
|
if (element.closest('[data-ga4-ecommerce-path]')) {
|
|
68
68
|
return
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
var target =
|
|
71
|
+
var target = trackFunctions.findTrackingAttributes(event.target, this.trackingTrigger)
|
|
72
72
|
if (target) {
|
|
73
73
|
try {
|
|
74
74
|
var data = target.getAttribute(this.trackingTrigger)
|
|
@@ -80,17 +80,19 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
var text = data.text || event.target.textContent
|
|
83
|
-
data.text =
|
|
84
|
-
data.text =
|
|
83
|
+
data.text = trackFunctions.removeLinesAndExtraSpaces(text)
|
|
84
|
+
data.text = trackFunctions.applyRedactionIfRequired(this.PIIRemover, element, data.text)
|
|
85
85
|
if (!data.text && (element.querySelector('img') || element.querySelector('svg') || element.tagName === 'IMG' || element.closest('svg'))) {
|
|
86
86
|
data.text = 'image'
|
|
87
87
|
}
|
|
88
88
|
var url = data.url || this.findLink(event.target).getAttribute('href')
|
|
89
|
-
data.url =
|
|
90
|
-
data.
|
|
91
|
-
data.
|
|
92
|
-
data.
|
|
93
|
-
data.
|
|
89
|
+
data.url = trackFunctions.removeCrossDomainParams(url)
|
|
90
|
+
data.url = trackFunctions.applyRedactionIfRequired(this.PIIRemover, element, data.url)
|
|
91
|
+
data.url = trackFunctions.appendPathToAnchorLinks(data.url)
|
|
92
|
+
data.link_domain = trackFunctions.populateLinkDomain(data.url)
|
|
93
|
+
data.link_path_parts = trackFunctions.populateLinkPathParts(data.url)
|
|
94
|
+
data.method = trackFunctions.getClickType(event)
|
|
95
|
+
data.external = trackFunctions.isExternalLink(data.url) ? 'true' : 'false'
|
|
94
96
|
data.index = this.setIndex(data.index, event.target)
|
|
95
97
|
|
|
96
98
|
if (data.type === 'smart answer' && data.action === 'change response') {
|
|
@@ -538,6 +538,10 @@
|
|
|
538
538
|
// -------------------------------------------------------------------------
|
|
539
539
|
// Settings
|
|
540
540
|
// -------------------------------------------------------------------------
|
|
541
|
+
// This ID usually appended to the end of the lux.js as a query string when
|
|
542
|
+
// using the SpeedCurve hosted version - but we have to include it here as
|
|
543
|
+
// this is self hosted.
|
|
544
|
+
LUX.customerid = 47044334;
|
|
541
545
|
// Set the sample rate to 1% to avoid all events being sent.
|
|
542
546
|
LUX.samplerate = 1;
|
|
543
547
|
// -------------------------------------------------------------------------
|
|
@@ -1494,10 +1498,9 @@
|
|
|
1494
1498
|
}
|
|
1495
1499
|
return getHighPercentileINP();
|
|
1496
1500
|
}
|
|
1501
|
+
// function simplified for our use, original would get the customerid from the script src URL
|
|
1502
|
+
// but we set it inside the code in this file, so this function just returns that
|
|
1497
1503
|
function getCustomerId() {
|
|
1498
|
-
if (!LUX.customerid) {
|
|
1499
|
-
LUX.customerid = thisScript.src.match(/id=(\d+)/).pop();
|
|
1500
|
-
}
|
|
1501
1504
|
return LUX.customerid || "";
|
|
1502
1505
|
}
|
|
1503
1506
|
function avgDomDepth() {
|
|
@@ -2200,11 +2203,6 @@
|
|
|
2200
2203
|
// More settings
|
|
2201
2204
|
// ---------------------------------------------------------------------------
|
|
2202
2205
|
//
|
|
2203
|
-
// This ID usually appended to the end of the lux.js as a query string when
|
|
2204
|
-
// using the SpeedCurve hosted version - but we have to include it here as
|
|
2205
|
-
// this is self hosted.
|
|
2206
|
-
LUX.customerid = 47044334;
|
|
2207
|
-
|
|
2208
2206
|
// Setting debug to `true` shows what happening as it happens. Running
|
|
2209
2207
|
// `LUX.getDebug()` in the browser's console will show the history of what's
|
|
2210
2208
|
// happened.
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: govuk_publishing_components
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 35.15.
|
|
4
|
+
version: 35.15.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- GOV.UK Dev
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-09-
|
|
11
|
+
date: 2023-09-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: govuk_app_config
|