govuk_publishing_components 30.7.1 → 30.7.2

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: 5541caeb04840db83172565a1e2f4f8f572850a113132c5e67d3d46ab00caf1e
4
- data.tar.gz: 81d4933ed8632f6bcc89a575a7a208e4575b7a842d0aa844bbfce317a69de9f9
3
+ metadata.gz: 3c7f16760ab4f91b2f86e6dda6f9066d33f3e1dc305170a0a7aca313df2fbf63
4
+ data.tar.gz: 7484fc85aad02f15bdb4de512979855520517a7cff39b6f8c7365be85666f176
5
5
  SHA512:
6
- metadata.gz: 6f8eea00f619818ebbbf6f83a3ffcb63b7d06c62dda8f45aab579f2b13ae363864ff8dbd4cabdcdac331e1fa95174660a9709e845b972aa06c6be8c9f550d439
7
- data.tar.gz: da2bb07ca8ab25c753f29af58965afb1dea0cfd781f57e7aea2129fce4a26db90346858341f7d9ba7adb572b5f7867db3a45586d487b56b5b98e151d9932d21b
6
+ metadata.gz: 19878d148ec4971e70494e929eb372e1c83411ca86e14435afba05929feb01d793c3300152150f11fe94370ae98997b30c2759a1b5c84dff4e81d7013446631a
7
+ data.tar.gz: 9e29ae1795f429a733a63da7da96382318a9a590e767086222e47802c075a0a6b510d511e57205a95d63a0528e03b6458d9e4266ca092e617134b71d8db58387
@@ -6,14 +6,44 @@ window.GOVUK.analyticsGA4 = window.GOVUK.analyticsGA4 || {};
6
6
 
7
7
  var core = {
8
8
  load: function () {
9
- /* eslint-disable */
10
- (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
11
- new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
12
- j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
13
- 'https://www.googletagmanager.com/gtm.js?id='+i+dl+ '&gtm_auth=' + window.GOVUK.analyticsGA4.vars.auth + '&gtm_preview=' + window.GOVUK.analyticsGA4.vars.preview + '&gtm_cookies_win=x';f.parentNode.insertBefore(j,f);
14
- })(window,document,'script','dataLayer',window.GOVUK.analyticsGA4.vars.id);
15
- window.dataLayer.push({ 'gtm.blocklist' : ['customPixels', 'customScripts', 'html', 'nonGoogleScripts'] })
16
- /* eslint-enable */
9
+ if (window.GOVUK.analyticsGA4.vars.gtag_id) {
10
+ // initialise gtag
11
+ window.dataLayer = window.dataLayer || []
12
+ function gtag() { dataLayer.push(arguments) }
13
+ gtag('js', new Date())
14
+ gtag('config', window.GOVUK.analyticsGA4.vars.gtag_id)
15
+
16
+ var firstScript = document.getElementsByTagName('script')[0]
17
+ var newScript = document.createElement('script')
18
+ var dl = 'dataLayer' != 'dataLayer' ? '&l=' + 'dataLayer' : ''
19
+
20
+ newScript.async = true
21
+ newScript.src = '//www.googletagmanager.com/gtag/js?id=' + window.GOVUK.analyticsGA4.vars.gtag_id + dl
22
+ firstScript.parentNode.insertBefore(newScript, firstScript)
23
+ } else {
24
+ // initialise GTM
25
+ window.dataLayer = window.dataLayer || []
26
+ window.dataLayer.push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' })
27
+
28
+ var firstScript = document.getElementsByTagName('script')[0]
29
+ var newScript = document.createElement('script')
30
+ var dl = 'dataLayer' != 'dataLayer' ? '&l=' + 'dataLayer' : ''
31
+
32
+ var auth = window.GOVUK.analyticsGA4.vars.auth || ''
33
+ var preview = window.GOVUK.analyticsGA4.vars.preview || ''
34
+ if (auth) {
35
+ auth = '&gtm_auth=' + auth
36
+ }
37
+ if (preview) {
38
+ preview = '&gtm_preview=' + preview + '&gtm_cookies_win=x'
39
+ }
40
+
41
+ newScript.async = true
42
+ this.googleSrc = 'https://www.googletagmanager.com/gtm.js?id=' + window.GOVUK.analyticsGA4.vars.id + dl + auth + preview
43
+ newScript.src = this.googleSrc
44
+ firstScript.parentNode.insertBefore(newScript, firstScript)
45
+ window.dataLayer.push({ 'gtm.blocklist' : ['customPixels', 'customScripts', 'html', 'nonGoogleScripts'] })
46
+ }
17
47
  },
18
48
 
19
49
  sendData: function (data) {
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "30.7.1".freeze
2
+ VERSION = "30.7.2".freeze
3
3
  end
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.1
4
+ version: 30.7.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: 2022-09-22 00:00:00.000000000 Z
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