govuk_publishing_components 30.7.1 → 30.7.3
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
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,14 +8,45 @@ window.GOVUK.analyticsGA4 = window.GOVUK.analyticsGA4 || {};
|
|
6
8
|
|
7
9
|
var core = {
|
8
10
|
load: function () {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
var firstScript
|
12
|
+
var newScript
|
13
|
+
|
14
|
+
if (window.GOVUK.analyticsGA4.vars.gtag_id) {
|
15
|
+
// initialise gtag
|
16
|
+
window.dataLayer = window.dataLayer || []
|
17
|
+
var gtag = function () { window.dataLayer.push(arguments) }
|
18
|
+
gtag('js', new Date())
|
19
|
+
gtag('config', window.GOVUK.analyticsGA4.vars.gtag_id)
|
20
|
+
|
21
|
+
firstScript = document.getElementsByTagName('script')[0]
|
22
|
+
newScript = document.createElement('script')
|
23
|
+
|
24
|
+
newScript.async = true
|
25
|
+
newScript.src = '//www.googletagmanager.com/gtag/js?id=' + window.GOVUK.analyticsGA4.vars.gtag_id
|
26
|
+
firstScript.parentNode.insertBefore(newScript, firstScript)
|
27
|
+
} else {
|
28
|
+
// initialise GTM
|
29
|
+
window.dataLayer = window.dataLayer || []
|
30
|
+
window.dataLayer.push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' })
|
31
|
+
|
32
|
+
firstScript = document.getElementsByTagName('script')[0]
|
33
|
+
newScript = document.createElement('script')
|
34
|
+
|
35
|
+
var auth = window.GOVUK.analyticsGA4.vars.auth || ''
|
36
|
+
var preview = window.GOVUK.analyticsGA4.vars.preview || ''
|
37
|
+
if (auth) {
|
38
|
+
auth = '>m_auth=' + auth
|
39
|
+
}
|
40
|
+
if (preview) {
|
41
|
+
preview = '>m_preview=' + preview + '>m_cookies_win=x'
|
42
|
+
}
|
43
|
+
|
44
|
+
newScript.async = true
|
45
|
+
this.googleSrc = 'https://www.googletagmanager.com/gtm.js?id=' + window.GOVUK.analyticsGA4.vars.id + auth + preview
|
46
|
+
newScript.src = this.googleSrc
|
47
|
+
firstScript.parentNode.insertBefore(newScript, firstScript)
|
48
|
+
window.dataLayer.push({ 'gtm.blocklist': ['customPixels', 'customScripts', 'html', 'nonGoogleScripts'] })
|
49
|
+
}
|
17
50
|
},
|
18
51
|
|
19
52
|
sendData: function (data) {
|
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: 30.7.
|
4
|
+
version: 30.7.3
|
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: 2022-09-
|
11
|
+
date: 2022-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_app_config
|