govuk_publishing_components 23.2.1 → 23.3.0

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: 1b95df6fab59121d237e5dddeeda753bbd1282ddabdab8f3fcba6a81088f0a33
4
- data.tar.gz: 3592d8cea5ca48b42089e2722f34f80a0a8896c39aefe7ecb57867f8859bf5dc
3
+ metadata.gz: 023220040cfb5795cd3e6b148e22b442144f18028ef8e09853e764b004a5de0a
4
+ data.tar.gz: 5b2a54316ce8efa8ae221bf8dddf3948934a2472838f629abbda0b2d56bc7f42
5
5
  SHA512:
6
- metadata.gz: 42cdaee623f79b09dd0da4d8ca0cf1c503ffd53b2d74d8affbe68d6d86a300f81025b42d6769eec75c1f71433b8270b75d248eaddd39e7650bf17a4850a04ff3
7
- data.tar.gz: 576e1c494014b4c6b8ac3bec21277b51662aa9e3024c8113ae4e6388abe02a9bb2f40e744abe7513e719d2e5810f3e03dca3be7bb9ef3c618631432aed966fee
6
+ metadata.gz: 62418105d4b33b8d133b05dcbbf7f440fd0159e07144f8a9c9de272ccb2061c832b54d1233efdbecf91269aa0b98a97fa589ffba74591e86ae9892deef1cfb82
7
+ data.tar.gz: 21a872c9340a3f6d8d95dcfa60a4935d1d945d75f24cd5a3427649679d062948d34e8f38a60429ca14f85243bc322beff2c87756ea489b828ca60fcdf714a689
@@ -1,8 +1,14 @@
1
- var analyticsInit = function (gaProperty, gaPropertyCrossDomain, linkedDomains) {
1
+ var analyticsInit = function () {
2
2
  'use strict'
3
3
 
4
- var consentCookie = window.GOVUK.getConsentCookie()
4
+ var analyticsVars = window.GOVUK.analyticsVars || false
5
+ if (analyticsVars) {
6
+ var gaProperty = window.GOVUK.analyticsVars.gaProperty || false
7
+ var gaPropertyCrossDomain = window.GOVUK.analyticsVars.gaPropertyCrossDomain || false
8
+ var linkedDomains = window.GOVUK.analyticsVars.linkedDomains || false
9
+ }
5
10
 
11
+ var consentCookie = window.GOVUK.getConsentCookie()
6
12
  var dummyAnalytics = {
7
13
  addLinkedTrackerDomain: function () {},
8
14
  setDimension: function () {},
@@ -23,22 +29,24 @@ var analyticsInit = function (gaProperty, gaPropertyCrossDomain, linkedDomains)
23
29
  // Load Google Analytics libraries
24
30
  window.GOVUK.StaticAnalytics.load()
25
31
 
26
- // Use document.domain in dev, preview and staging so that tracking works
27
- // Otherwise explicitly set the domain as www.gov.uk (and not gov.uk).
28
- var cookieDomain = (document.domain === 'www.gov.uk') ? '.www.gov.uk' : document.domain
32
+ if (gaProperty) {
33
+ // Use document.domain in dev, preview and staging so that tracking works
34
+ // Otherwise explicitly set the domain as www.gov.uk (and not gov.uk).
35
+ var cookieDomain = (document.domain === 'www.gov.uk') ? '.www.gov.uk' : document.domain
29
36
 
30
- // Configure profiles, setup custom vars, track initial pageview
31
- var analytics = new window.GOVUK.StaticAnalytics({
32
- universalId: gaProperty,
33
- cookieDomain: cookieDomain,
34
- allowLinker: true
35
- })
37
+ // Configure profiles, setup custom vars, track initial pageview
38
+ var analytics = new window.GOVUK.StaticAnalytics({
39
+ universalId: gaProperty,
40
+ cookieDomain: cookieDomain,
41
+ allowLinker: true
42
+ })
36
43
 
37
- // Make interface public for virtual pageviews and events
38
- window.GOVUK.analytics = analytics
44
+ // Make interface public for virtual pageviews and events
45
+ window.GOVUK.analytics = analytics
39
46
 
40
- if (linkedDomains && linkedDomains.length > 0) {
41
- window.GOVUK.analytics.addLinkedTrackerDomain(gaPropertyCrossDomain, 'govuk', linkedDomains)
47
+ if (linkedDomains && linkedDomains.length > 0) {
48
+ window.GOVUK.analytics.addLinkedTrackerDomain(gaPropertyCrossDomain, 'govuk', linkedDomains)
49
+ }
42
50
  }
43
51
  } else {
44
52
  window.GOVUK.analytics = dummyAnalytics
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "23.2.1".freeze
2
+ VERSION = "23.3.0".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: 23.2.1
4
+ version: 23.3.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: 2020-11-02 00:00:00.000000000 Z
11
+ date: 2020-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config