govuk_publishing_components 24.13.5 → 24.14.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/rum-loader.js.erb +36 -0
- data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-polyfill.js +159 -0
- data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux.js +844 -0
- data/app/views/govuk_publishing_components/components/_government_navigation.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +2 -0
- data/config/initializers/assets.rb +3 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83c35c9f2649e67c8a1afb3c98c6c6017eecfd762eae1d96c1cd695d03907af3
|
4
|
+
data.tar.gz: 7a2cab9a09d767a5b60d2b725b3dbb4219acd03ff06fc64d3410be04e8902b28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4f467944c4c94230b55ab05a1fb75b26dcc561bccd253a67f61176ad5240f914011dfe602097a544b43886b7cf4f6cfd0821c8828bfc145489acfb752b696b7
|
7
|
+
data.tar.gz: c7113db1463f8a20ffd3071851280fb26e4b0ee1874fea5a2300aecb283e817cabdb75762f34aed367569f23cc7fafbba4f5f9ef1b6bc5b495e9397df44eca01
|
@@ -0,0 +1,36 @@
|
|
1
|
+
(function() {
|
2
|
+
var marker = document.getElementsByTagName('script')[0]
|
3
|
+
var scripts = [
|
4
|
+
'<%= path_to_javascript("govuk_publishing_components/vendor/lux/lux-polyfill") %>',
|
5
|
+
'<%= path_to_javascript("govuk_publishing_components/vendor/lux/lux") %>'
|
6
|
+
]
|
7
|
+
var parsedCookie = (function() {
|
8
|
+
try {
|
9
|
+
var cookies = document.cookie.split(';')
|
10
|
+
|
11
|
+
for (var i = 0; i < cookies.length; i++) {
|
12
|
+
var cookie = cookies[i].replace(/\s/g, '') // Remove all whitespace.
|
13
|
+
var cookieName = 'cookies_policy='
|
14
|
+
|
15
|
+
if (cookie.indexOf(cookieName) === 0) {
|
16
|
+
return JSON.parse(cookie.substring(cookieName.length))
|
17
|
+
}
|
18
|
+
}
|
19
|
+
} catch (error) {
|
20
|
+
console.error(error)
|
21
|
+
}
|
22
|
+
|
23
|
+
return {}
|
24
|
+
})()
|
25
|
+
|
26
|
+
if (parsedCookie.usage === true) {
|
27
|
+
for (var i = 0; i < scripts.length; i++) {
|
28
|
+
var script = document.createElement('script')
|
29
|
+
script.src = scripts[i]
|
30
|
+
script.async = true
|
31
|
+
script.defer = true
|
32
|
+
|
33
|
+
marker.parentNode.insertBefore(script, marker)
|
34
|
+
}
|
35
|
+
}
|
36
|
+
})()
|
@@ -0,0 +1,159 @@
|
|
1
|
+
/* eslint-disable */
|
2
|
+
|
3
|
+
/*
|
4
|
+
* Part of Speedcurve's LUX script, which allows us to run real user metrics on
|
5
|
+
* pages using the public layout template.
|
6
|
+
*
|
7
|
+
* See docs/real-user-metrics.md for more information.
|
8
|
+
*/
|
9
|
+
|
10
|
+
LUX = (function () {
|
11
|
+
var a =
|
12
|
+
"undefined" !== typeof LUX && "undefined" !== typeof LUX.gaMarks
|
13
|
+
? LUX.gaMarks
|
14
|
+
: [];
|
15
|
+
var d =
|
16
|
+
"undefined" !== typeof LUX && "undefined" !== typeof LUX.gaMeasures
|
17
|
+
? LUX.gaMeasures
|
18
|
+
: [];
|
19
|
+
var j = "LUX_start";
|
20
|
+
var k = window.performance;
|
21
|
+
var l =
|
22
|
+
"undefined" !== typeof LUX && LUX.ns
|
23
|
+
? LUX.ns
|
24
|
+
: Date.now
|
25
|
+
? Date.now()
|
26
|
+
: +new Date();
|
27
|
+
if (k && k.timing && k.timing.navigationStart) {
|
28
|
+
l = k.timing.navigationStart;
|
29
|
+
}
|
30
|
+
function f() {
|
31
|
+
if (k && k.now) {
|
32
|
+
return k.now();
|
33
|
+
}
|
34
|
+
var o = Date.now ? Date.now() : +new Date();
|
35
|
+
return o - l;
|
36
|
+
}
|
37
|
+
function b(n) {
|
38
|
+
if (k) {
|
39
|
+
if (k.mark) {
|
40
|
+
return k.mark(n);
|
41
|
+
} else {
|
42
|
+
if (k.webkitMark) {
|
43
|
+
return k.webkitMark(n);
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
a.push({ name: n, entryType: "mark", startTime: f(), duration: 0 });
|
48
|
+
return;
|
49
|
+
}
|
50
|
+
function m(p, t, n) {
|
51
|
+
if ("undefined" === typeof t && h(j)) {
|
52
|
+
t = j;
|
53
|
+
}
|
54
|
+
if (k) {
|
55
|
+
if (k.measure) {
|
56
|
+
if (t) {
|
57
|
+
if (n) {
|
58
|
+
return k.measure(p, t, n);
|
59
|
+
} else {
|
60
|
+
return k.measure(p, t);
|
61
|
+
}
|
62
|
+
} else {
|
63
|
+
return k.measure(p);
|
64
|
+
}
|
65
|
+
} else {
|
66
|
+
if (k.webkitMeasure) {
|
67
|
+
return k.webkitMeasure(p, t, n);
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
71
|
+
var r = 0,
|
72
|
+
o = f();
|
73
|
+
if (t) {
|
74
|
+
var s = h(t);
|
75
|
+
if (s) {
|
76
|
+
r = s.startTime;
|
77
|
+
} else {
|
78
|
+
if (k && k.timing && k.timing[t]) {
|
79
|
+
r = k.timing[t] - k.timing.navigationStart;
|
80
|
+
} else {
|
81
|
+
return;
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}
|
85
|
+
if (n) {
|
86
|
+
var q = h(n);
|
87
|
+
if (q) {
|
88
|
+
o = q.startTime;
|
89
|
+
} else {
|
90
|
+
if (k && k.timing && k.timing[n]) {
|
91
|
+
o = k.timing[n] - k.timing.navigationStart;
|
92
|
+
} else {
|
93
|
+
return;
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
d.push({ name: p, entryType: "measure", startTime: r, duration: o - r });
|
98
|
+
return;
|
99
|
+
}
|
100
|
+
function h(n) {
|
101
|
+
return c(n, g());
|
102
|
+
}
|
103
|
+
function c(p, o) {
|
104
|
+
for (i = o.length - 1; i >= 0; i--) {
|
105
|
+
var n = o[i];
|
106
|
+
if (p === n.name) {
|
107
|
+
return n;
|
108
|
+
}
|
109
|
+
}
|
110
|
+
return undefined;
|
111
|
+
}
|
112
|
+
function g() {
|
113
|
+
if (k) {
|
114
|
+
if (k.getEntriesByType) {
|
115
|
+
return k.getEntriesByType("mark");
|
116
|
+
} else {
|
117
|
+
if (k.webkitGetEntriesByType) {
|
118
|
+
return k.webkitGetEntriesByType("mark");
|
119
|
+
}
|
120
|
+
}
|
121
|
+
}
|
122
|
+
return a;
|
123
|
+
}
|
124
|
+
return { mark: b, measure: m, gaMarks: a, gaMeasures: d };
|
125
|
+
})();
|
126
|
+
LUX.ns = Date.now ? Date.now() : +new Date();
|
127
|
+
LUX.ac = [];
|
128
|
+
LUX.cmd = function (a) {
|
129
|
+
LUX.ac.push(a);
|
130
|
+
};
|
131
|
+
LUX.init = function () {
|
132
|
+
LUX.cmd(["init"]);
|
133
|
+
};
|
134
|
+
LUX.send = function () {
|
135
|
+
LUX.cmd(["send"]);
|
136
|
+
};
|
137
|
+
LUX.addData = function (a, b) {
|
138
|
+
LUX.cmd(["addData", a, b]);
|
139
|
+
};
|
140
|
+
LUX_ae = [];
|
141
|
+
window.addEventListener("error", function (a) {
|
142
|
+
LUX_ae.push(a);
|
143
|
+
});
|
144
|
+
LUX_al = [];
|
145
|
+
if (
|
146
|
+
"function" === typeof PerformanceObserver &&
|
147
|
+
"function" === typeof PerformanceLongTaskTiming
|
148
|
+
) {
|
149
|
+
var LongTaskObserver = new PerformanceObserver(function (c) {
|
150
|
+
var b = c.getEntries();
|
151
|
+
for (var a = 0; a < b.length; a++) {
|
152
|
+
var d = b[a];
|
153
|
+
LUX_al.push(d);
|
154
|
+
}
|
155
|
+
});
|
156
|
+
try {
|
157
|
+
LongTaskObserver.observe({ type: ["longtask"] });
|
158
|
+
} catch (e) {}
|
159
|
+
}
|
@@ -0,0 +1,844 @@
|
|
1
|
+
/* eslint-disable */
|
2
|
+
|
3
|
+
/*
|
4
|
+
* Part of Speedcurve's LUX script, which allows us to run real user metrics on
|
5
|
+
* pages using the public layout template.
|
6
|
+
*
|
7
|
+
* See docs/real-user-metrics.md for more information.
|
8
|
+
*/
|
9
|
+
|
10
|
+
|
11
|
+
/* ! Remember to keep the settings at the end of this file when updating LUX.
|
12
|
+
*
|
13
|
+
* The settings are:
|
14
|
+
* * `LUX.customerid = 47044334` to let LUX know who this is
|
15
|
+
* * `LUX.beaconMode = "simple"` to fire the beacon as an image, which is now
|
16
|
+
* allowed by the content security policy.
|
17
|
+
* * `LUX.debug = false` turns debugging on and off. Left set to false - and
|
18
|
+
* kept in the file so it's easier to remember that this can be turned on.
|
19
|
+
*/
|
20
|
+
|
21
|
+
var LUX_t_start = Date.now(),
|
22
|
+
LUX = window.LUX || {};
|
23
|
+
LUX = function() {
|
24
|
+
var gaLog = [];
|
25
|
+
dlog("lux.js evaluation start.");
|
26
|
+
var version = "214",
|
27
|
+
_errorUrl = "https://lux.speedcurve.com/error/",
|
28
|
+
nErrors = 0,
|
29
|
+
maxErrors = 5;
|
30
|
+
|
31
|
+
function errorHandler(e) {
|
32
|
+
nErrors++, e && void 0 !== e.filename && void 0 !== e.message && (-1 !== e.filename.indexOf("/lux.js?") || -1 !== e.message.indexOf("LUX") || nErrors <= maxErrors && "function" == typeof _sample && _sample()) && ((new Image).src = _errorUrl + "?v=" + version + "&id=" + getCustomerId() + "&fn=" + encodeURIComponent(e.filename) + "&ln=" + e.lineno + "&cn=" + e.colno + "&msg=" + encodeURIComponent(e.message) + "&l=" + encodeURIComponent(_getPageLabel()) + (connectionType() ? "&ct=" + connectionType() : ""))
|
33
|
+
}
|
34
|
+
window.addEventListener("error", errorHandler);
|
35
|
+
var gaPerfEntries = "object" == typeof window.LUX_al ? window.LUX_al.slice() : [];
|
36
|
+
if ("function" == typeof PerformanceObserver) {
|
37
|
+
var perfObserver = new PerformanceObserver((function(e) {
|
38
|
+
e.getEntries().forEach((function(e) {
|
39
|
+
gaPerfEntries.push(e)
|
40
|
+
}))
|
41
|
+
}));
|
42
|
+
try {
|
43
|
+
"function" == typeof PerformanceLongTaskTiming && perfObserver.observe({
|
44
|
+
type: "longtask"
|
45
|
+
}), "function" == typeof LargestContentfulPaint && perfObserver.observe({
|
46
|
+
type: "largest-contentful-paint",
|
47
|
+
buffered: !0
|
48
|
+
}), "function" == typeof PerformanceElementTiming && perfObserver.observe({
|
49
|
+
type: "element",
|
50
|
+
buffered: !0
|
51
|
+
}), "function" == typeof PerformancePaintTiming && perfObserver.observe({
|
52
|
+
type: "paint",
|
53
|
+
buffered: !0
|
54
|
+
}), "function" == typeof LayoutShift && perfObserver.observe({
|
55
|
+
type: "layout-shift",
|
56
|
+
buffered: !0
|
57
|
+
})
|
58
|
+
} catch (e) {
|
59
|
+
dlog("Long Tasks error.")
|
60
|
+
}
|
61
|
+
} else dlog("Long Tasks not supported.");
|
62
|
+
var gFlags = 0,
|
63
|
+
gFlag_InitCalled = 1,
|
64
|
+
gFlag_NoNavTiming = 2,
|
65
|
+
gFlag_NoUserTiming = 4,
|
66
|
+
gFlag_NotVisible = 8,
|
67
|
+
gaMarks = void 0 !== LUX.gaMarks ? LUX.gaMarks : [],
|
68
|
+
gaMeasures = void 0 !== LUX.gaMeasures ? LUX.gaMeasures : [],
|
69
|
+
ghIx = {},
|
70
|
+
ghData = {},
|
71
|
+
gbLuxSent = 0,
|
72
|
+
gbNavSent = 0,
|
73
|
+
gbIxSent = 0,
|
74
|
+
gbUpdated = 0,
|
75
|
+
gbFirstPV = 1,
|
76
|
+
gStartMark = "LUX_start",
|
77
|
+
gEndMark = "LUX_end",
|
78
|
+
gSessionTimeout = 1800,
|
79
|
+
gSyncId = createSyncId(),
|
80
|
+
gUid = refreshUniqueId(gSyncId),
|
81
|
+
gCustomerDataTimeout, perf = window.performance,
|
82
|
+
gMaxQuerystring = 2e3,
|
83
|
+
_beaconUrl = void 0 !== LUX.beaconUrl ? LUX.beaconUrl : "https://lux.speedcurve.com/lux/",
|
84
|
+
_samplerate = void 0 !== LUX.samplerate ? LUX.samplerate : 100;
|
85
|
+
dlog("Sample rate = " + _samplerate + "%. " + (_sample() ? "This session IS being sampled." : "This session is NOT being sampled. The data will NOT show up in your LUX dashboards. Call LUX.forceSample() and try again."));
|
86
|
+
var _auto = void 0 === LUX.auto || LUX.auto,
|
87
|
+
_navigationStart = LUX.ns ? LUX.ns : Date.now ? Date.now() : +new Date,
|
88
|
+
gLuxSnippetStart = 0,
|
89
|
+
gFirstInputDelay;
|
90
|
+
perf && perf.timing && perf.timing.navigationStart ? (_navigationStart = perf.timing.navigationStart, gLuxSnippetStart = LUX.ns ? LUX.ns - _navigationStart : 0) : (dlog("Nav Timing is not supported."), gFlags |= gFlag_NoNavTiming);
|
91
|
+
var gaEventTypes = ["click", "mousedown", "keydown", "touchstart", "pointerdown"],
|
92
|
+
ghListenerOptions = {
|
93
|
+
passive: !0,
|
94
|
+
capture: !0
|
95
|
+
};
|
96
|
+
|
97
|
+
function recordDelay(e) {
|
98
|
+
gFirstInputDelay || (gFirstInputDelay = Math.round(e), gaEventTypes.forEach((function(e) {
|
99
|
+
removeEventListener(e, onInput, ghListenerOptions)
|
100
|
+
})))
|
101
|
+
}
|
102
|
+
|
103
|
+
function onPointerDown(e, t) {
|
104
|
+
function n() {
|
105
|
+
recordDelay(e, t), a()
|
106
|
+
}
|
107
|
+
|
108
|
+
function r() {
|
109
|
+
a()
|
110
|
+
}
|
111
|
+
|
112
|
+
function a() {
|
113
|
+
window.removeEventListener("pointerup", n, ghListenerOptions), window.removeEventListener("pointercancel", r, ghListenerOptions)
|
114
|
+
}
|
115
|
+
window.addEventListener("pointerup", n, ghListenerOptions), window.addEventListener("pointercancel", r, ghListenerOptions)
|
116
|
+
}
|
117
|
+
|
118
|
+
function onInput(e) {
|
119
|
+
var t = !1;
|
120
|
+
try {
|
121
|
+
t = e.cancelable
|
122
|
+
} catch (e) {
|
123
|
+
return void dlog("Permission error accessing input event.")
|
124
|
+
}
|
125
|
+
if (t) {
|
126
|
+
var n = _now(!0),
|
127
|
+
r = e.timeStamp;
|
128
|
+
if (r > 152e7 && (n = Number(new Date)), r > n) return;
|
129
|
+
var a = n - r;
|
130
|
+
"pointerdown" == e.type ? onPointerDown(a, e) : recordDelay(a, e)
|
131
|
+
}
|
132
|
+
}
|
133
|
+
|
134
|
+
function _now(e) {
|
135
|
+
var t = (Date.now ? Date.now() : +new Date) - _navigationStart,
|
136
|
+
n = _getMark(gStartMark);
|
137
|
+
return n && !e ? t - n.startTime : perf && perf.now ? perf.now() : t
|
138
|
+
}
|
139
|
+
|
140
|
+
function _mark(e) {
|
141
|
+
if (dlog("Enter LUX.mark(), name = " + e), perf) {
|
142
|
+
if (perf.mark) return perf.mark(e);
|
143
|
+
if (perf.webkitMark) return perf.webkitMark(e)
|
144
|
+
}
|
145
|
+
gFlags |= gFlag_NoUserTiming, gaMarks.push({
|
146
|
+
name: e,
|
147
|
+
entryType: "mark",
|
148
|
+
startTime: _now(),
|
149
|
+
duration: 0
|
150
|
+
})
|
151
|
+
}
|
152
|
+
|
153
|
+
function _measure(e, t, n) {
|
154
|
+
if (dlog("Enter LUX.measure(), name = " + e), void 0 === t && _getMark(gStartMark) && (t = gStartMark), perf) {
|
155
|
+
if (perf.measure) return t ? n ? perf.measure(e, t, n) : perf.measure(e, t) : perf.measure(e);
|
156
|
+
if (perf.webkitMeasure) return perf.webkitMeasure(e, t, n)
|
157
|
+
}
|
158
|
+
var r = 0,
|
159
|
+
a = _now();
|
160
|
+
if (t) {
|
161
|
+
var i = _getMark(t);
|
162
|
+
if (i) r = i.startTime;
|
163
|
+
else {
|
164
|
+
if (!(perf && perf.timing && perf.timing[t])) return;
|
165
|
+
r = perf.timing[t] - perf.timing.navigationStart
|
166
|
+
}
|
167
|
+
}
|
168
|
+
if (n) {
|
169
|
+
var o = _getMark(n);
|
170
|
+
if (o) a = o.startTime;
|
171
|
+
else {
|
172
|
+
if (!(perf && perf.timing && perf.timing[n])) return;
|
173
|
+
a = perf.timing[n] - perf.timing.navigationStart
|
174
|
+
}
|
175
|
+
}
|
176
|
+
gaMeasures.push({
|
177
|
+
name: e,
|
178
|
+
entryType: "measure",
|
179
|
+
startTime: r,
|
180
|
+
duration: a - r
|
181
|
+
})
|
182
|
+
}
|
183
|
+
|
184
|
+
function _getMark(e) {
|
185
|
+
return _getM(e, _getMarks())
|
186
|
+
}
|
187
|
+
|
188
|
+
function _getM(e, t) {
|
189
|
+
if (t)
|
190
|
+
for (var n = t.length - 1; n >= 0; n--) {
|
191
|
+
var r = t[n];
|
192
|
+
if (e === r.name) return r
|
193
|
+
}
|
194
|
+
}
|
195
|
+
|
196
|
+
function _getMarks() {
|
197
|
+
if (perf) {
|
198
|
+
if (perf.getEntriesByType) return perf.getEntriesByType("mark");
|
199
|
+
if (perf.webkitGetEntriesByType) return perf.webkitGetEntriesByType("mark")
|
200
|
+
}
|
201
|
+
return gaMarks
|
202
|
+
}
|
203
|
+
|
204
|
+
function _getMeasures() {
|
205
|
+
if (perf) {
|
206
|
+
if (perf.getEntriesByType) return perf.getEntriesByType("measure");
|
207
|
+
if (perf.webkitGetEntriesByType) return perf.webkitGetEntriesByType("measure")
|
208
|
+
}
|
209
|
+
return gaMeasures
|
210
|
+
}
|
211
|
+
|
212
|
+
function userTimingValues() {
|
213
|
+
var e = {},
|
214
|
+
t = _getMark(gStartMark),
|
215
|
+
n = _getMarks();
|
216
|
+
n && n.forEach((function(n) {
|
217
|
+
var r = n.name,
|
218
|
+
a = r !== gStartMark && t ? t.startTime : 0,
|
219
|
+
i = Math.round(n.startTime - a);
|
220
|
+
i < 0 || (void 0 === e[r] ? e[r] = i : e[r] = Math.max(i, e[r]))
|
221
|
+
}));
|
222
|
+
var r = _getMeasures();
|
223
|
+
r && r.forEach((function(n) {
|
224
|
+
if (!(t && n.startTime < t.startTime)) {
|
225
|
+
var r = n.name,
|
226
|
+
a = Math.round(n.duration);
|
227
|
+
void 0 === e[r] ? e[r] = a : e[r] = Math.max(a, e[r])
|
228
|
+
}
|
229
|
+
}));
|
230
|
+
var a = [];
|
231
|
+
return Object.keys(e).forEach((function(t) {
|
232
|
+
a.push(t + "|" + e[t])
|
233
|
+
})), a.join(",")
|
234
|
+
}
|
235
|
+
|
236
|
+
function elementTimingValues() {
|
237
|
+
var e = [];
|
238
|
+
if (gaPerfEntries.length)
|
239
|
+
for (var t = 0; t < gaPerfEntries.length; t++) {
|
240
|
+
var n = gaPerfEntries[t];
|
241
|
+
"element" === n.entryType && n.identifier && n.startTime && e.push(n.identifier + "|" + Math.round(n.startTime))
|
242
|
+
}
|
243
|
+
return e.join(",")
|
244
|
+
}
|
245
|
+
|
246
|
+
function cpuTimes() {
|
247
|
+
if ("function" != typeof PerformanceLongTaskTiming) return "";
|
248
|
+
var e = "",
|
249
|
+
t = {},
|
250
|
+
n = {};
|
251
|
+
if (gaPerfEntries.length)
|
252
|
+
for (var r = _getMark(gStartMark), a = r ? r.startTime : 0, i = r ? _getMark(gEndMark).startTime : perf.timing.loadEventEnd - perf.timing.navigationStart, o = 0; o < gaPerfEntries.length; o++) {
|
253
|
+
var s = gaPerfEntries[o];
|
254
|
+
if ("longtask" === s.entryType) {
|
255
|
+
var d = Math.round(s.duration);
|
256
|
+
if (s.startTime < a) d -= a - s.startTime;
|
257
|
+
else if (s.startTime >= i) continue;
|
258
|
+
var g = s.attribution[0].name;
|
259
|
+
t[g] || (t[g] = 0, n[g] = ""), t[g] += d, n[g] += "," + Math.round(s.startTime) + "|" + d
|
260
|
+
}
|
261
|
+
}
|
262
|
+
var u = void 0 !== t.script ? "script" : "unknown";
|
263
|
+
void 0 === t[u] && (t[u] = 0, n[u] = "");
|
264
|
+
var c = cpuStats(n[u]),
|
265
|
+
l = ",n|" + c.count + ",d|" + c.median + ",x|" + c.max + (0 === c.fci ? "" : ",i|" + c.fci);
|
266
|
+
return e += "s|" + t[u] + l + n[u]
|
267
|
+
}
|
268
|
+
|
269
|
+
function cpuStats(e) {
|
270
|
+
for (var t = 0, n = getFcp(), r = 0 === n, a = [], i = e.split(","), o = 0; o < i.length; o++) {
|
271
|
+
var s = i[o].split("|");
|
272
|
+
if (2 === s.length) {
|
273
|
+
var d = parseInt(s[0]),
|
274
|
+
g = parseInt(s[1]);
|
275
|
+
a.push(g), t = g > t ? g : t, !r && d > n && (d - n > 5e3 ? r = !0 : n = d + g)
|
276
|
+
}
|
277
|
+
}
|
278
|
+
return {
|
279
|
+
count: a.length,
|
280
|
+
median: arrayMedian(a),
|
281
|
+
max: t,
|
282
|
+
fci: n
|
283
|
+
}
|
284
|
+
}
|
285
|
+
|
286
|
+
function calculateDCLS() {
|
287
|
+
if ("function" != typeof LayoutShift) return !1;
|
288
|
+
for (var e = 0, t = 0; t < gaPerfEntries.length; t++) {
|
289
|
+
var n = gaPerfEntries[t];
|
290
|
+
"layout-shift" !== n.entryType || n.hadRecentInput || (e += n.value)
|
291
|
+
}
|
292
|
+
return e.toFixed(6)
|
293
|
+
}
|
294
|
+
|
295
|
+
function arrayMedian(e) {
|
296
|
+
if (0 === e.length) return 0;
|
297
|
+
var t = Math.floor(e.length / 2);
|
298
|
+
return e.sort((function(e, t) {
|
299
|
+
return e - t
|
300
|
+
})), e.length % 2 ? e[t] : Math.round((e[t - 1] + e[t]) / 2)
|
301
|
+
}
|
302
|
+
|
303
|
+
function selfLoading() {
|
304
|
+
var e = "";
|
305
|
+
if (perf && perf.getEntriesByName) {
|
306
|
+
var t = getScriptElement("/js/lux.js");
|
307
|
+
if (t) {
|
308
|
+
var n = perf.getEntriesByName(t.src);
|
309
|
+
if (n && n.length) {
|
310
|
+
var r = n[0],
|
311
|
+
a = Math.round(r.domainLookupEnd - r.domainLookupStart),
|
312
|
+
i = Math.round(r.connectEnd - r.connectStart),
|
313
|
+
o = Math.round(r.responseStart - r.requestStart),
|
314
|
+
s = Math.round(r.responseEnd - r.responseStart),
|
315
|
+
d = a + i + o + s,
|
316
|
+
g = LUX_t_end - LUX_t_start,
|
317
|
+
u = r.encodedBodySize ? r.encodedBodySize : 0;
|
318
|
+
e = "d" + a + "t" + i + "f" + o + "c" + s + "n" + d + "e" + g + "r" + _samplerate + (u ? "x" + u : "") + (gLuxSnippetStart ? "l" + gLuxSnippetStart : "") + "s" + (LUX_t_start - _navigationStart)
|
319
|
+
}
|
320
|
+
}
|
321
|
+
}
|
322
|
+
return e
|
323
|
+
}
|
324
|
+
|
325
|
+
function _clearIx() {
|
326
|
+
ghIx = {}
|
327
|
+
}
|
328
|
+
|
329
|
+
function ixValues() {
|
330
|
+
var e = [];
|
331
|
+
for (var t in ghIx) e.push(t + "|" + ghIx[t]);
|
332
|
+
return e.join(",")
|
333
|
+
}
|
334
|
+
|
335
|
+
function _addData(e, t) {
|
336
|
+
dlog("Enter LUX.addData(), name = " + e + ", value = " + t);
|
337
|
+
var n = typeof t;
|
338
|
+
"string" !== typeof e || "string" !== n && "number" !== n && "boolean" !== n || (ghData[e] = t), gbLuxSent && (gCustomerDataTimeout && clearTimeout(gCustomerDataTimeout), gCustomerDataTimeout = setTimeout(_sendCustomerData, 100))
|
339
|
+
}
|
340
|
+
|
341
|
+
function _sample() {
|
342
|
+
if (void 0 === gUid || void 0 === _samplerate) return !1;
|
343
|
+
var e = ("" + gUid).substr(-2);
|
344
|
+
return parseInt(e) < _samplerate
|
345
|
+
}
|
346
|
+
|
347
|
+
function customerDataValues() {
|
348
|
+
var e = [];
|
349
|
+
for (var t in ghData) {
|
350
|
+
var n = "" + ghData[t];
|
351
|
+
t = t.replace(/,/g, "").replace(/\|/g, ""), n = n.replace(/,/g, "").replace(/\|/g, ""), e.push(t + "|" + n)
|
352
|
+
}
|
353
|
+
return encodeURIComponent(e.join(","))
|
354
|
+
}
|
355
|
+
|
356
|
+
function _init() {
|
357
|
+
dlog("Enter LUX.init()."), _clearIx(), _removeIxHandlers(), _addIxHandlers(), gbNavSent = 0, gbLuxSent = 0, gbIxSent = 0, gbFirstPV = 0, gSyncId = createSyncId(), gUid = refreshUniqueId(gSyncId), gaPerfEntries.splice(0), gFlags = 0, gFlags |= gFlag_InitCalled, _mark(gStartMark)
|
358
|
+
}
|
359
|
+
|
360
|
+
function blockingScripts() {
|
361
|
+
var e = lastViewportElement();
|
362
|
+
if (!e) return syncScripts();
|
363
|
+
for (var t = document.getElementsByTagName("script"), n = 0, r = 0, a = t.length; r < a; r++) {
|
364
|
+
var i = t[r];
|
365
|
+
!i.src || i.async || i.defer || 0 == (4 & i.compareDocumentPosition(e)) || n++
|
366
|
+
}
|
367
|
+
return n
|
368
|
+
}
|
369
|
+
|
370
|
+
function blockingStylesheets() {
|
371
|
+
for (var e = 0, t = document.getElementsByTagName("link"), n = 0, r = t.length; n < r; n++) {
|
372
|
+
var a = t[n];
|
373
|
+
a.href && "stylesheet" === a.rel && 0 !== a.href.indexOf("data:") && (a.onloadcssdefined || "print" === a.media || "style" === a.as || "function" == typeof a.onload && "all" === a.media || e++)
|
374
|
+
}
|
375
|
+
return e
|
376
|
+
}
|
377
|
+
|
378
|
+
function syncScripts() {
|
379
|
+
for (var e = document.getElementsByTagName("script"), t = 0, n = 0, r = e.length; n < r; n++) {
|
380
|
+
var a = e[n];
|
381
|
+
!a.src || a.async || a.defer || t++
|
382
|
+
}
|
383
|
+
return t
|
384
|
+
}
|
385
|
+
|
386
|
+
function numScripts() {
|
387
|
+
for (var e = document.getElementsByTagName("script"), t = 0, n = 0, r = e.length; n < r; n++) {
|
388
|
+
e[n].src && t++
|
389
|
+
}
|
390
|
+
return t
|
391
|
+
}
|
392
|
+
|
393
|
+
function numStylesheets() {
|
394
|
+
for (var e = document.getElementsByTagName("link"), t = 0, n = 0, r = e.length; n < r; n++) {
|
395
|
+
var a = e[n];
|
396
|
+
a.href && "stylesheet" == a.rel && t++
|
397
|
+
}
|
398
|
+
return t
|
399
|
+
}
|
400
|
+
|
401
|
+
function inlineTagSize(e) {
|
402
|
+
for (var t = document.getElementsByTagName(e), n = 0, r = 0, a = t.length; r < a; r++) {
|
403
|
+
var i = t[r];
|
404
|
+
try {
|
405
|
+
n += i.innerHTML.length
|
406
|
+
} catch (i) {
|
407
|
+
return dlog("Error accessing inline element innerHTML."), -1
|
408
|
+
}
|
409
|
+
}
|
410
|
+
return n
|
411
|
+
}
|
412
|
+
|
413
|
+
function getNavTiming() {
|
414
|
+
var e = "",
|
415
|
+
t = _navigationStart;
|
416
|
+
if (_getMark(gStartMark) && _getMark(gEndMark)) {
|
417
|
+
var n = Math.round(_getMark(gStartMark).startTime);
|
418
|
+
e = (t += n) + "fs0ls" + (s = Math.round(_getMark(gEndMark).startTime) - n) + "le" + s
|
419
|
+
} else if (perf && perf.timing) {
|
420
|
+
var r = perf.timing,
|
421
|
+
a = getStartRender(),
|
422
|
+
i = getFcp(),
|
423
|
+
o = getLcp();
|
424
|
+
e = t + (r.redirectStart ? "rs" + (r.redirectStart - t) : "") + (r.redirectEnd ? "re" + (r.redirectEnd - t) : "") + (r.fetchStart ? "fs" + (r.fetchStart - t) : "") + (r.domainLookupStart ? "ds" + (r.domainLookupStart - t) : "") + (r.domainLookupEnd ? "de" + (r.domainLookupEnd - t) : "") + (r.connectStart ? "cs" + (r.connectStart - t) : "") + (r.secureConnectionStart ? "sc" + (r.secureConnectionStart - t) : "") + (r.connectEnd ? "ce" + (r.connectEnd - t) : "") + (r.requestStart ? "qs" + (r.requestStart - t) : "") + (r.responseStart ? "bs" + (r.responseStart - t) : "") + (r.responseEnd ? "be" + (r.responseEnd - t) : "") + (r.domLoading ? "ol" + (r.domLoading - t) : "") + (r.domInteractive ? "oi" + (r.domInteractive - t) : "") + (r.domContentLoadedEventStart ? "os" + (r.domContentLoadedEventStart - t) : "") + (r.domContentLoadedEventEnd ? "oe" + (r.domContentLoadedEventEnd - t) : "") + (r.domComplete ? "oc" + (r.domComplete - t) : "") + (r.loadEventStart ? "ls" + (r.loadEventStart - t) : "") + (r.loadEventEnd ? "le" + (r.loadEventEnd - t) : "") + (a ? "sr" + a : "") + (i ? "fc" + i : "") + (o ? "lc" + o : "")
|
425
|
+
} else if (_getMark(gEndMark)) {
|
426
|
+
var s;
|
427
|
+
e = t + "fs0ls" + (s = Math.round(_getMark(gEndMark).startTime)) + "le" + s
|
428
|
+
}
|
429
|
+
return e
|
430
|
+
}
|
431
|
+
|
432
|
+
function getFcp() {
|
433
|
+
if (perf && perf.getEntriesByType && perf.getEntriesByType("paint"))
|
434
|
+
for (var e = perf.getEntriesByType("paint"), t = 0; t < e.length; t++) {
|
435
|
+
var n = e[t];
|
436
|
+
if ("first-contentful-paint" === n.name) return Math.round(n.startTime)
|
437
|
+
}
|
438
|
+
return 0
|
439
|
+
}
|
440
|
+
|
441
|
+
function getLcp() {
|
442
|
+
if (gaPerfEntries.length)
|
443
|
+
for (var e = gaPerfEntries.length - 1; e >= 0; e--) {
|
444
|
+
var t = gaPerfEntries[e];
|
445
|
+
if ("largest-contentful-paint" === t.entryType) return Math.round(t.startTime)
|
446
|
+
}
|
447
|
+
return 0
|
448
|
+
}
|
449
|
+
|
450
|
+
function getStartRender() {
|
451
|
+
if (perf && perf.timing) {
|
452
|
+
var e, t = perf.timing,
|
453
|
+
n = t.navigationStart;
|
454
|
+
if (n) {
|
455
|
+
if (perf && perf.getEntriesByType && perf.getEntriesByType("paint") && perf.getEntriesByType("paint").length)
|
456
|
+
for (var r = perf.getEntriesByType("paint"), a = 0; a < r.length; a++) {
|
457
|
+
var i = r[a];
|
458
|
+
if ("first-paint" === i.name) {
|
459
|
+
e = Math.round(i.startTime);
|
460
|
+
break
|
461
|
+
}
|
462
|
+
} else if (window.chrome && "function" == typeof window.chrome.loadTimes) {
|
463
|
+
var o = window.chrome.loadTimes();
|
464
|
+
o && (e = Math.round(1e3 * o.firstPaintTime - n))
|
465
|
+
} else t.msFirstPaint && (e = Math.round(t.msFirstPaint - n));
|
466
|
+
if (e > 0) return e
|
467
|
+
}
|
468
|
+
}
|
469
|
+
return dlog("Paint Timing not supported."), null
|
470
|
+
}
|
471
|
+
|
472
|
+
function getCustomerId() {
|
473
|
+
if (void 0 !== LUX.customerid) return LUX.customerid;
|
474
|
+
var e = getScriptElement("/js/lux.js");
|
475
|
+
return e ? (LUX.customerid = getQuerystringParam(e.src, "id"), LUX.customerid) : ""
|
476
|
+
}
|
477
|
+
|
478
|
+
function getScriptElement(e) {
|
479
|
+
for (var t = document.getElementsByTagName("script"), n = 0, r = t.length; n < r; n++) {
|
480
|
+
var a = t[n];
|
481
|
+
if (a.src && -1 !== a.src.indexOf(e)) return a
|
482
|
+
}
|
483
|
+
return null
|
484
|
+
}
|
485
|
+
|
486
|
+
function getQuerystringParam(e, t) {
|
487
|
+
for (var n = e.split("?")[1].split("&"), r = 0, a = n.length; r < a; r++) {
|
488
|
+
var i = n[r].split("=");
|
489
|
+
if (t === i[0]) return i[1]
|
490
|
+
}
|
491
|
+
}
|
492
|
+
|
493
|
+
function avgDomDepth() {
|
494
|
+
for (var e = document.getElementsByTagName("*"), t = e.length, n = 0; t--;) n += numParents(e[t]);
|
495
|
+
return Math.round(n / e.length)
|
496
|
+
}
|
497
|
+
|
498
|
+
function numParents(e) {
|
499
|
+
var t = 0;
|
500
|
+
if (e.parentNode)
|
501
|
+
for (; e = e.parentNode;) t++;
|
502
|
+
return t
|
503
|
+
}
|
504
|
+
|
505
|
+
function docHeight(e) {
|
506
|
+
var t = e.body,
|
507
|
+
n = e.documentElement;
|
508
|
+
return Math.max(t ? t.scrollHeight : 0, t ? t.offsetHeight : 0, n ? n.clientHeight : 0, n ? n.scrollHeight : 0, n ? n.offsetHeight : 0)
|
509
|
+
}
|
510
|
+
|
511
|
+
function docWidth(e) {
|
512
|
+
var t = e.body,
|
513
|
+
n = e.documentElement;
|
514
|
+
return Math.max(t ? t.scrollWidth : 0, t ? t.offsetWidth : 0, n ? n.clientWidth : 0, n ? n.scrollWidth : 0, n ? n.offsetWidth : 0)
|
515
|
+
}
|
516
|
+
|
517
|
+
function docSize() {
|
518
|
+
if (perf && perf.getEntriesByType) {
|
519
|
+
var e = performance.getEntriesByType("navigation");
|
520
|
+
if (e && e.length > 0 && e[0].encodedBodySize) return e[0].encodedBodySize
|
521
|
+
}
|
522
|
+
return 0
|
523
|
+
}
|
524
|
+
|
525
|
+
function navigationType() {
|
526
|
+
return perf && perf.navigation && void 0 !== perf.navigation.type ? perf.navigation.type : ""
|
527
|
+
}
|
528
|
+
|
529
|
+
function connectionType() {
|
530
|
+
var e = navigator.connection,
|
531
|
+
t = "";
|
532
|
+
return e && e.effectiveType && (t = "slow-2g" === (t = e.effectiveType) ? "Slow 2G" : "2g" === t || "3g" === t || "4g" === t || "5g" === t ? t.toUpperCase() : t.charAt(0).toUpperCase() + t.slice(1)), t
|
533
|
+
}
|
534
|
+
|
535
|
+
function imagesATF() {
|
536
|
+
var e = document.getElementsByTagName("img"),
|
537
|
+
t = [];
|
538
|
+
if (e)
|
539
|
+
for (var n = 0, r = e.length; n < r; n++) {
|
540
|
+
var a = e[n];
|
541
|
+
inViewport(a) && t.push(a)
|
542
|
+
}
|
543
|
+
return t
|
544
|
+
}
|
545
|
+
|
546
|
+
function lastViewportElement(e) {
|
547
|
+
var t;
|
548
|
+
if (e || (e = document.body), e) {
|
549
|
+
var n = e.children;
|
550
|
+
if (n)
|
551
|
+
for (var r = 0, a = n.length; r < a; r++) {
|
552
|
+
var i = n[r];
|
553
|
+
inViewport(i) && (t = i)
|
554
|
+
}
|
555
|
+
}
|
556
|
+
return t ? lastViewportElement(t) : e
|
557
|
+
}
|
558
|
+
|
559
|
+
function inViewport(e) {
|
560
|
+
var t = document.documentElement.clientHeight,
|
561
|
+
n = document.documentElement.clientWidth,
|
562
|
+
r = findPos(e);
|
563
|
+
return r[0] >= 0 && r[1] >= 0 && r[0] < n && r[1] < t && e.offsetWidth > 0 && e.offsetHeight > 0
|
564
|
+
}
|
565
|
+
|
566
|
+
function findPos(e) {
|
567
|
+
for (var t = 0, n = 0; e;) t += e.offsetLeft, n += e.offsetTop, e = e.offsetParent;
|
568
|
+
return [t, n]
|
569
|
+
}
|
570
|
+
|
571
|
+
function _sendLux() {
|
572
|
+
dlog("Enter LUX.send().");
|
573
|
+
var e = getCustomerId();
|
574
|
+
if (e && gSyncId && validDomain() && _sample() && !gbLuxSent) {
|
575
|
+
_mark(gEndMark);
|
576
|
+
var t = userTimingValues(),
|
577
|
+
n = elementTimingValues(),
|
578
|
+
r = customerDataValues(),
|
579
|
+
a = "";
|
580
|
+
gbIxSent || (a = ixValues());
|
581
|
+
var i = cpuTimes(),
|
582
|
+
o = calculateDCLS(),
|
583
|
+
s = selfLoading();
|
584
|
+
document.visibilityState && "visible" !== document.visibilityState && (gFlags |= gFlag_NotVisible);
|
585
|
+
var d = _beaconUrl + "?v=" + version + "&id=" + e + "&sid=" + gSyncId + "&uid=" + gUid + (r ? "&CD=" + r : "") + "&l=" + encodeURIComponent(_getPageLabel()),
|
586
|
+
g = inlineTagSize("script"),
|
587
|
+
u = inlineTagSize("style"),
|
588
|
+
c = (gbNavSent ? "" : "&NT=" + getNavTiming()) + (gbFirstPV ? "&LJS=" + s : "") + "&PS=ns" + numScripts() + "bs" + blockingScripts() + (g > -1 ? "is" + g : "") + "ss" + numStylesheets() + "bc" + blockingStylesheets() + (u > -1 ? "ic" + u : "") + "ia" + imagesATF().length + "it" + document.getElementsByTagName("img").length + "dd" + avgDomDepth() + "nd" + document.getElementsByTagName("*").length + "vh" + document.documentElement.clientHeight + "vw" + document.documentElement.clientWidth + "dh" + docHeight(document) + "dw" + docWidth(document) + (docSize() ? "ds" + docSize() : "") + (connectionType() ? "ct" + connectionType() + "_" : "") + "er" + nErrors + "nt" + navigationType() + (navigator.deviceMemory ? "dm" + Math.round(navigator.deviceMemory) : "") + (a ? "&IX=" + a : "") + (gFirstInputDelay ? "&FID=" + gFirstInputDelay : "") + (i ? "&CPU=" + i : "") + (gFlags ? "&fl=" + gFlags : "") + (n ? "&ET=" + n : "") + "&HN=" + encodeURIComponent(document.location.hostname) + (!1 !== o ? "&CLS=" + o : ""),
|
589
|
+
l = "";
|
590
|
+
if (t) {
|
591
|
+
var f = d.length + c.length;
|
592
|
+
if (f + t.length <= gMaxQuerystring) c += "&UT=" + t;
|
593
|
+
else {
|
594
|
+
var m = gMaxQuerystring - f,
|
595
|
+
p = t.lastIndexOf(",", m);
|
596
|
+
c += "&UT=" + t.substring(0, p), l = t.substring(p + 1)
|
597
|
+
}
|
598
|
+
}
|
599
|
+
var v = d + c;
|
600
|
+
dlog("Sending main LUX beacon: " + v), _sendBeacon(v), gbLuxSent = 1, gbNavSent = 1, gbIxSent = a ? 1 : 0;
|
601
|
+
for (var h = gMaxQuerystring - d.length; l;) {
|
602
|
+
var y = "";
|
603
|
+
if (l.length <= h) y = l, l = "";
|
604
|
+
else {
|
605
|
+
var _ = l.lastIndexOf(",", h); - 1 === _ && (_ = l.indexOf(",")), -1 === _ ? (y = l, l = "") : (y = l.substring(0, _), l = l.substring(_ + 1))
|
606
|
+
}
|
607
|
+
var L = d + "&UT=" + y;
|
608
|
+
dlog("Sending extra User Timing beacon: " + L), _sendBeacon(L)
|
609
|
+
}
|
610
|
+
}
|
611
|
+
}
|
612
|
+
|
613
|
+
function _sendIx() {
|
614
|
+
var e = getCustomerId();
|
615
|
+
if (e && gSyncId && validDomain() && _sample() && !gbIxSent && gbLuxSent) {
|
616
|
+
var t = ixValues();
|
617
|
+
if (t) {
|
618
|
+
var n = customerDataValues(),
|
619
|
+
r = "?v=" + version + "&id=" + e + "&sid=" + gSyncId + "&uid=" + gUid + (n ? "&CD=" + n : "") + "&l=" + encodeURIComponent(_getPageLabel()) + "&IX=" + t + (gFirstInputDelay ? "&FID=" + gFirstInputDelay : "") + "&HN=" + encodeURIComponent(document.location.hostname),
|
620
|
+
a = _beaconUrl + r;
|
621
|
+
dlog("Sending Interaction Metrics beacon: " + a), _sendBeacon(a), gbIxSent = 1
|
622
|
+
}
|
623
|
+
}
|
624
|
+
}
|
625
|
+
|
626
|
+
function _sendCustomerData() {
|
627
|
+
var e = getCustomerId();
|
628
|
+
if (e && gSyncId && validDomain() && _sample() && gbLuxSent) {
|
629
|
+
var t = customerDataValues();
|
630
|
+
if (t) {
|
631
|
+
var n = "?v=" + version + "&id=" + e + "&sid=" + gSyncId + "&uid=" + gUid + "&CD=" + t + "&l=" + encodeURIComponent(_getPageLabel()) + "&HN=" + encodeURIComponent(document.location.hostname),
|
632
|
+
r = _beaconUrl + n;
|
633
|
+
dlog("Sending late Customer Data beacon: " + r), _sendBeacon(r)
|
634
|
+
}
|
635
|
+
}
|
636
|
+
}
|
637
|
+
|
638
|
+
function _sendBeacon(e) {
|
639
|
+
if ("simple" !== LUX.beaconMode) return _sendBeaconAutoUpdate(e);
|
640
|
+
(new Image).src = e
|
641
|
+
}
|
642
|
+
|
643
|
+
function _sendBeaconAutoUpdate(e) {
|
644
|
+
var t = document.createElement("script");
|
645
|
+
t.async = !0, t.src = e;
|
646
|
+
var n = document.getElementsByTagName("script");
|
647
|
+
n.length ? n[0].parentNode.insertBefore(t, n[0]) : ((n = document.getElementsByTagName("head")).length || (n = document.getElementsByTagName("body")).length) && n[0].appendChild(t)
|
648
|
+
}
|
649
|
+
|
650
|
+
function interactionAttributionForElement(e) {
|
651
|
+
if (e.id) return e.id;
|
652
|
+
for (var t, n = e; n.parentNode && n.parentNode.tagName;) {
|
653
|
+
if ((n = n.parentNode).hasAttribute("data-sctrack")) return n.getAttribute("data-sctrack");
|
654
|
+
n.id && !t && (t = n.id)
|
655
|
+
}
|
656
|
+
var r = "INPUT" === e.tagName && "submit" === e.type,
|
657
|
+
a = "BUTTON" === e.tagName,
|
658
|
+
i = "A" === e.tagName;
|
659
|
+
return r && e.value ? e.value : (a || i) && e.innerText ? e.innerText : t || ""
|
660
|
+
}
|
661
|
+
|
662
|
+
function _scrollHandler() {
|
663
|
+
void 0 === ghIx.s && (ghIx.s = Math.round(_now()))
|
664
|
+
}
|
665
|
+
|
666
|
+
function _keyHandler(e) {
|
667
|
+
if (_removeIxHandlers(), void 0 === ghIx.k) {
|
668
|
+
if (ghIx.k = Math.round(_now()), e && e.target) {
|
669
|
+
var t = interactionAttributionForElement(e.target);
|
670
|
+
t && (ghIx.ki = t)
|
671
|
+
}
|
672
|
+
_sendIx()
|
673
|
+
}
|
674
|
+
}
|
675
|
+
|
676
|
+
function _clickHandler(e) {
|
677
|
+
if (_removeIxHandlers(), void 0 === ghIx.c) {
|
678
|
+
ghIx.c = Math.round(_now());
|
679
|
+
var t = null;
|
680
|
+
try {
|
681
|
+
e && e.target && (t = e.target)
|
682
|
+
} catch (e) {
|
683
|
+
dlog("Error accessing event target."), t = null
|
684
|
+
}
|
685
|
+
if (t) {
|
686
|
+
e.clientX && (ghIx.cx = e.clientX, ghIx.cy = e.clientY);
|
687
|
+
var n = interactionAttributionForElement(e.target);
|
688
|
+
n && (ghIx.ci = n)
|
689
|
+
}
|
690
|
+
_sendIx()
|
691
|
+
}
|
692
|
+
}
|
693
|
+
|
694
|
+
function _doUpdate(e, t) {
|
695
|
+
if (e && version < e && document.body && !gbUpdated) {
|
696
|
+
dlog("Updating cached version of lux.js from " + version + " to " + e + "."), gbUpdated = 1;
|
697
|
+
var n = getScriptElement("/js/lux.js");
|
698
|
+
if (n)
|
699
|
+
if ("function" == typeof fetch) fetch(n.src, {
|
700
|
+
cache: "reload"
|
701
|
+
});
|
702
|
+
else {
|
703
|
+
var r = document.createElement("iframe");
|
704
|
+
r.style.display = "none", r.id = "LUX_update_iframe", r.src = "//cdn.speedcurve.com/luxupdate.php?src=" + encodeURIComponent(n.src) + (t ? "&tw=" + t : ""), document.body.appendChild(r)
|
705
|
+
}
|
706
|
+
}
|
707
|
+
}
|
708
|
+
|
709
|
+
function addListener(e, t) {
|
710
|
+
window.addEventListener ? window.addEventListener(e, t, !1) : window.attachEvent && window.attachEvent("on" + e, t)
|
711
|
+
}
|
712
|
+
|
713
|
+
function removeListener(e, t) {
|
714
|
+
window.removeEventListener ? window.removeEventListener(e, t, !1) : window.detachEvent && window.detachEvent("on" + e, t)
|
715
|
+
}
|
716
|
+
|
717
|
+
function _addIxHandlers() {
|
718
|
+
addListener("scroll", _scrollHandler), addListener("keypress", _keyHandler), addListener("mousedown", _clickHandler)
|
719
|
+
}
|
720
|
+
|
721
|
+
function _removeIxHandlers() {
|
722
|
+
removeListener("scroll", _scrollHandler), removeListener("keypress", _keyHandler), removeListener("mousedown", _clickHandler)
|
723
|
+
}
|
724
|
+
|
725
|
+
function createSyncId(e) {
|
726
|
+
return e ? Number(new Date) + "00000" : Number(new Date) + "" + _padLeft(parseInt(1e5 * Math.random()), "00000")
|
727
|
+
}
|
728
|
+
|
729
|
+
function refreshUniqueId(e) {
|
730
|
+
var t = _getCookie("lux_uid");
|
731
|
+
if (!t || t.length < 11) t = e;
|
732
|
+
else {
|
733
|
+
var n = parseInt(t.substring(0, 10));
|
734
|
+
Number(new Date) / 1e3 - n > 86400 && (t = e)
|
735
|
+
}
|
736
|
+
return setUniqueId(t), t
|
737
|
+
}
|
738
|
+
|
739
|
+
function setUniqueId(e) {
|
740
|
+
return _setCookie("lux_uid", e, gSessionTimeout), e
|
741
|
+
}
|
742
|
+
|
743
|
+
function _getUniqueId() {
|
744
|
+
return gUid
|
745
|
+
}
|
746
|
+
|
747
|
+
function _getPageLabel() {
|
748
|
+
if (void 0 !== LUX.label) return LUX.label;
|
749
|
+
if (void 0 !== LUX.jspagelabel) {
|
750
|
+
try {
|
751
|
+
var label = eval(LUX.jspagelabel)
|
752
|
+
} catch (e) {
|
753
|
+
console.log("Error evaluating customer settings LUX page label:", e)
|
754
|
+
}
|
755
|
+
if (label) return label
|
756
|
+
}
|
757
|
+
return document.title
|
758
|
+
}
|
759
|
+
|
760
|
+
function validDomain() {
|
761
|
+
return !0
|
762
|
+
}
|
763
|
+
|
764
|
+
function _getCookie(e) {
|
765
|
+
try {
|
766
|
+
for (var t = document.cookie.split(";"), n = 0; n < t.length; n++) {
|
767
|
+
var r = t[n].split("=");
|
768
|
+
if (e === r[0].trim()) return unescape(r[1])
|
769
|
+
}
|
770
|
+
} catch (e) {
|
771
|
+
dlog("Error accessing document.cookie.")
|
772
|
+
}
|
773
|
+
}
|
774
|
+
|
775
|
+
function _setCookie(e, t, n) {
|
776
|
+
try {
|
777
|
+
document.cookie = e + "=" + escape(t) + (n ? "; max-age=" + n : "") + "; path=/; SameSite=Lax"
|
778
|
+
} catch (e) {
|
779
|
+
dlog("Error setting document.cookie.")
|
780
|
+
}
|
781
|
+
}
|
782
|
+
|
783
|
+
function _padLeft(e, t) {
|
784
|
+
return (t + e).slice(-t.length)
|
785
|
+
}
|
786
|
+
|
787
|
+
function dlog(e) {
|
788
|
+
gaLog.push(e), LUX.debug && console.log("LUX: " + e)
|
789
|
+
}
|
790
|
+
gaEventTypes.forEach((function(e) {
|
791
|
+
window.addEventListener(e, onInput, ghListenerOptions)
|
792
|
+
})), _auto && ("complete" == document.readyState ? _sendLux() : addListener("load", (function() {
|
793
|
+
setTimeout(_sendLux, 200)
|
794
|
+
})), addListener("beforeunload", _sendLux), addListener("unload", _sendLux), addListener("beforeunload", _sendIx), addListener("unload", _sendIx)), _addIxHandlers();
|
795
|
+
var _LUX = {
|
796
|
+
mark: _mark,
|
797
|
+
measure: _measure,
|
798
|
+
init: _init,
|
799
|
+
send: _sendLux,
|
800
|
+
addData: _addData,
|
801
|
+
getSessionId: _getUniqueId,
|
802
|
+
getDebug: function() {
|
803
|
+
return gaLog
|
804
|
+
},
|
805
|
+
forceSample: function() {
|
806
|
+
setUniqueId(createSyncId(!0)), console.log("Sampling has been turned on for this session.")
|
807
|
+
},
|
808
|
+
doUpdate: _doUpdate,
|
809
|
+
cmd: function(e) {
|
810
|
+
var t = e.shift();
|
811
|
+
"function" == typeof _LUX[t] && _LUX[t].apply(_LUX, e)
|
812
|
+
},
|
813
|
+
beaconUrl: _beaconUrl,
|
814
|
+
samplerate: _samplerate,
|
815
|
+
auto: _auto,
|
816
|
+
label: void 0 !== LUX.label ? LUX.label : void 0,
|
817
|
+
jspagelabel: void 0 !== LUX.jspagelabel ? LUX.jspagelabel : void 0,
|
818
|
+
version: version,
|
819
|
+
ae: [],
|
820
|
+
al: [],
|
821
|
+
debug: !!LUX.debug
|
822
|
+
};
|
823
|
+
return LUX.ac && LUX.ac.length && LUX.ac.forEach((function(e) {
|
824
|
+
var t = e.shift();
|
825
|
+
"function" == typeof _LUX[t] && _LUX[t].apply(_LUX, e)
|
826
|
+
})), void 0 !== window.LUX_ae && window.LUX_ae.forEach((function(e) {
|
827
|
+
errorHandler(e)
|
828
|
+
})), dlog("lux.js evaluation end."), _LUX
|
829
|
+
}();
|
830
|
+
var LUX_t_end = Date.now();
|
831
|
+
|
832
|
+
// This ID usually appended to the end of the lux.js as a query string when
|
833
|
+
// using the SpeedCurve hosted version - but we have to include it here as this
|
834
|
+
// is self hosted.
|
835
|
+
LUX.customerid = 47044334;
|
836
|
+
|
837
|
+
// Turn on the image-based beacon, rather than have a remote JavaScript file
|
838
|
+
// fetched and executed.
|
839
|
+
LUX.beaconMode = "simple";
|
840
|
+
|
841
|
+
// Setting debug to `true` shows what happening as it happens. Running
|
842
|
+
// `LUX.getDebug()` in the browser's console will show the history of what's
|
843
|
+
// happened.
|
844
|
+
LUX.debug = false;
|
@@ -52,7 +52,7 @@
|
|
52
52
|
<a class="<%= 'active' if active == 'consultations' %> govuk-link govuk-link--no-underline govuk-link--inverse"
|
53
53
|
data-track-category="headerClicked"
|
54
54
|
data-track-action="governmentactivityLink"
|
55
|
-
data-track-label="/
|
55
|
+
data-track-label="<%= CGI::escapeHTML('/search/policy-papers-and-consultations?content_store_document_type[]=open_consultations&content_store_document_type[]=closed_consultations') %>"
|
56
56
|
data-track-dimension="<%= t("components.government_navigation.consultations") %>"
|
57
57
|
data-track-dimension-index="29"
|
58
58
|
href="<%= CGI::escapeHTML('/search/policy-papers-and-consultations?content_store_document_type[]=open_consultations&content_store_document_type[]=closed_consultations') %>">
|
@@ -63,7 +63,7 @@
|
|
63
63
|
<a class="<%= 'active' if active == 'statistics' %> govuk-link govuk-link--no-underline govuk-link--inverse"
|
64
64
|
data-track-category="headerClicked"
|
65
65
|
data-track-action="governmentactivityLink"
|
66
|
-
data-track-label="/
|
66
|
+
data-track-label="/search/research-and-statistics"
|
67
67
|
data-track-dimension="<%= t("components.government_navigation.statistics") %>"
|
68
68
|
data-track-dimension-index="29"
|
69
69
|
href="/search/research-and-statistics">
|
@@ -7,6 +7,9 @@ Rails.application.config.assets.precompile += %w[
|
|
7
7
|
component_guide/filter-components.js
|
8
8
|
component_guide/visual-regression.js
|
9
9
|
component_guide/print.css
|
10
|
+
govuk_publishing_components/rum-loader.js
|
11
|
+
govuk_publishing_components/vendor/lux.js
|
12
|
+
govuk_publishing_components/vendor/lux-polyfill.js
|
10
13
|
govuk_publishing_components/all_components.js
|
11
14
|
govuk_publishing_components/ie.js
|
12
15
|
govuk_publishing_components/modules.js
|
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: 24.
|
4
|
+
version: 24.14.0
|
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: 2021-06-
|
11
|
+
date: 2021-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_app_config
|
@@ -484,8 +484,11 @@ files:
|
|
484
484
|
- app/assets/javascripts/govuk_publishing_components/lib/track-click.js
|
485
485
|
- app/assets/javascripts/govuk_publishing_components/lib/trigger-event.js
|
486
486
|
- app/assets/javascripts/govuk_publishing_components/modules.js
|
487
|
+
- app/assets/javascripts/govuk_publishing_components/rum-loader.js.erb
|
487
488
|
- app/assets/javascripts/govuk_publishing_components/vendor/html5shiv-printshiv.js
|
488
489
|
- app/assets/javascripts/govuk_publishing_components/vendor/json2.js
|
490
|
+
- app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-polyfill.js
|
491
|
+
- app/assets/javascripts/govuk_publishing_components/vendor/lux/lux.js
|
489
492
|
- app/assets/javascripts/govuk_publishing_components/vendor/modernizr.js
|
490
493
|
- app/assets/javascripts/govuk_publishing_components/vendor/polyfills/closest.js
|
491
494
|
- app/assets/javascripts/govuk_publishing_components/vendor/polyfills/common.js
|