govuk_publishing_components 30.7.2 → 30.7.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a0126e6016869d447d661d4e1c4777d68a10292c19e388bcb22477021877b7b
|
4
|
+
data.tar.gz: e83f7124df4f9126819c1f11310bfda63dde08be6c57749ead9395eef1d58ea0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03ac390a2a2a9fa5378699daac0dab1a55551bee3ab995f159487c5a5d295a3ff139629fab6b9f0b95dc52bc4d89d5b941f867e00c20fe9562eafbb5d5af43ef
|
7
|
+
data.tar.gz: ee961b5da8eacf0d47567ae446a1c1741ea65576affbdeb84916bb48a64064de8383c1ad64de86da84def9ad5f13c034c7893dca904a7a64e8405b0133754e37
|
@@ -1,3 +1,5 @@
|
|
1
|
+
// note that because this file is .js.erb it is not linted
|
2
|
+
// temporarily rename to .js to check with the linter
|
1
3
|
window.GOVUK = window.GOVUK || {}
|
2
4
|
window.GOVUK.analyticsGA4 = window.GOVUK.analyticsGA4 || {};
|
3
5
|
|
@@ -6,28 +8,29 @@ window.GOVUK.analyticsGA4 = window.GOVUK.analyticsGA4 || {};
|
|
6
8
|
|
7
9
|
var core = {
|
8
10
|
load: function () {
|
11
|
+
var firstScript
|
12
|
+
var newScript
|
13
|
+
|
9
14
|
if (window.GOVUK.analyticsGA4.vars.gtag_id) {
|
10
15
|
// initialise gtag
|
11
16
|
window.dataLayer = window.dataLayer || []
|
12
|
-
function
|
17
|
+
var gtag = function () { window.dataLayer.push(arguments) }
|
13
18
|
gtag('js', new Date())
|
14
19
|
gtag('config', window.GOVUK.analyticsGA4.vars.gtag_id)
|
15
20
|
|
16
|
-
|
17
|
-
|
18
|
-
var dl = 'dataLayer' != 'dataLayer' ? '&l=' + 'dataLayer' : ''
|
21
|
+
firstScript = document.getElementsByTagName('script')[0]
|
22
|
+
newScript = document.createElement('script')
|
19
23
|
|
20
24
|
newScript.async = true
|
21
|
-
newScript.src = '//www.googletagmanager.com/gtag/js?id=' + window.GOVUK.analyticsGA4.vars.gtag_id
|
25
|
+
newScript.src = '//www.googletagmanager.com/gtag/js?id=' + window.GOVUK.analyticsGA4.vars.gtag_id
|
22
26
|
firstScript.parentNode.insertBefore(newScript, firstScript)
|
23
27
|
} else {
|
24
28
|
// initialise GTM
|
25
29
|
window.dataLayer = window.dataLayer || []
|
26
30
|
window.dataLayer.push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' })
|
27
31
|
|
28
|
-
|
29
|
-
|
30
|
-
var dl = 'dataLayer' != 'dataLayer' ? '&l=' + 'dataLayer' : ''
|
32
|
+
firstScript = document.getElementsByTagName('script')[0]
|
33
|
+
newScript = document.createElement('script')
|
31
34
|
|
32
35
|
var auth = window.GOVUK.analyticsGA4.vars.auth || ''
|
33
36
|
var preview = window.GOVUK.analyticsGA4.vars.preview || ''
|
@@ -39,10 +42,10 @@ window.GOVUK.analyticsGA4 = window.GOVUK.analyticsGA4 || {};
|
|
39
42
|
}
|
40
43
|
|
41
44
|
newScript.async = true
|
42
|
-
this.googleSrc = 'https://www.googletagmanager.com/gtm.js?id=' + window.GOVUK.analyticsGA4.vars.id +
|
45
|
+
this.googleSrc = 'https://www.googletagmanager.com/gtm.js?id=' + window.GOVUK.analyticsGA4.vars.id + auth + preview
|
43
46
|
newScript.src = this.googleSrc
|
44
47
|
firstScript.parentNode.insertBefore(newScript, firstScript)
|
45
|
-
window.dataLayer.push({ 'gtm.blocklist'
|
48
|
+
window.dataLayer.push({ 'gtm.blocklist': ['customPixels', 'customScripts', 'html', 'nonGoogleScripts'] })
|
46
49
|
}
|
47
50
|
},
|
48
51
|
|