govuk_frontend_toolkit 5.2.0 → 6.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 10e14060edb1dcd3b797adabfa3408ee1e24b602
4
- data.tar.gz: b3a7b2d53b0d3885cd1ece60fdd42061e14b4920
3
+ metadata.gz: c691fea11a81b6e13b02691132d0ce0c5e844650
4
+ data.tar.gz: ca6ab6ace0a2813e9426d2744603a5cabf366a8c
5
5
  SHA512:
6
- metadata.gz: 5cd4d8a1610f9a7d7422da67d6be2f587c9e4c2bb1e342822e4095bf6befb25dbf7765f3bd517f1699d82c6db8d57181b7b8b4ab719af9e6877249ec018db3b1
7
- data.tar.gz: b062f6e142d07c95774fef6fe0b259803258de20702e27b419fc711795049d1b426150b946d34aebe43fbf097bfd9cc07652eb7507b817c4914010df2962e80d
6
+ metadata.gz: 545412034afbd354d886e2d018c35cd6d69226106ac7108e980b8b6aeea46c5fdb7d60760c68b636d107e467a9194b30cc3cc6eecfe4d8041d9ae82693695d0d
7
+ data.tar.gz: 248e6eee38422db39cb27c6e88becc1c6597721296de86494ee05d71bfef2bcd378d10ccde9388cb4aa9f6dc92c21370b0ca5c23b4a8d04050481c16f087b03c
@@ -1,3 +1,9 @@
1
+ # 6.0.0
2
+
3
+ - Breaking change: configure the GOV.UK Analytics tracker with `govukTrackerUrl` instead of `govukTrackerGifUrl` ([PR #405](https://github.com/alphagov/govuk_frontend_toolkit/pull/405))
4
+ - Fix the sending of the GA Client ID with calls to the GOV.UK Tracker ([PR #404](https://github.com/alphagov/govuk_frontend_toolkit/pull/404))
5
+ - Disable GA ad tracking ([PR #401](https://github.com/alphagov/govuk_frontend_toolkit/pull/401))
6
+
1
7
  # 5.2.0
2
8
 
3
9
  - Deprecate selection-buttons.js. Add a deprecation warning: Custom radio buttons and checkboxes (released in GOV.UK Elements 3.0.0) no longer require this JavaScript.
@@ -1 +1 @@
1
- 5.2.0
1
+ 6.0.0
@@ -13,10 +13,10 @@
13
13
  delete config.universalId
14
14
  this.trackers.push(new GOVUK.GoogleAnalyticsUniversalTracker(universalId, config))
15
15
  }
16
- if (typeof config.govukTrackerGifUrl !== 'undefined') {
17
- var govukTrackerGifUrl = config.govukTrackerGifUrl
18
- delete config.govukTrackerGifUrl
19
- this.trackers.push(new GOVUK.GOVUKTracker(govukTrackerGifUrl))
16
+ if (typeof config.govukTrackerUrl !== 'undefined') {
17
+ var govukTrackerUrl = config.govukTrackerUrl
18
+ delete config.govukTrackerUrl
19
+ this.trackers.push(new GOVUK.GOVUKTracker(govukTrackerUrl))
20
20
  }
21
21
  }
22
22
 
@@ -15,6 +15,11 @@
15
15
  sendToGa('set', 'anonymizeIp', true)
16
16
  }
17
17
 
18
+ function disableAdTracking () {
19
+ // https://support.google.com/analytics/answer/2444872?hl=en
20
+ sendToGa('set', 'displayFeaturesTask', null)
21
+ }
22
+
18
23
  // Support legacy cookieDomain param
19
24
  if (typeof fieldsObject === 'string') {
20
25
  fieldsObject = { cookieDomain: fieldsObject }
@@ -22,6 +27,7 @@
22
27
 
23
28
  configureProfile()
24
29
  anonymizeIp()
30
+ disableAdTracking()
25
31
  }
26
32
 
27
33
  GoogleAnalyticsUniversalTracker.load = function () {
@@ -135,6 +141,7 @@
135
141
  sendToGa(name + '.linker:autoLink', [domain])
136
142
 
137
143
  sendToGa(name + '.set', 'anonymizeIp', true)
144
+ sendToGa(name + '.set', 'displayFeaturesTask', null)
138
145
  sendToGa(name + '.send', 'pageview')
139
146
  }
140
147
 
@@ -7,11 +7,6 @@
7
7
  var GOVUKTracker = function (gifUrl) {
8
8
  this.gifUrl = gifUrl
9
9
  this.dimensions = []
10
- if (global.ga) {
11
- global.ga(function (tracker) {
12
- this.gaClientId = tracker.get('clientId')
13
- }.bind(this))
14
- }
15
10
  }
16
11
 
17
12
  GOVUKTracker.load = function () {}
@@ -118,7 +113,14 @@
118
113
 
119
114
  GOVUKTracker.prototype.sendToTracker = function (type, payload) {
120
115
  $(global.document).ready(function () {
121
- this.sendData(this.payloadParams(type, payload))
116
+ if (global.ga) {
117
+ global.ga(function (tracker) {
118
+ this.gaClientId = tracker.get('clientId')
119
+ this.sendData(this.payloadParams(type, payload))
120
+ }.bind(this))
121
+ } else {
122
+ this.sendData(this.payloadParams(type, payload))
123
+ }
122
124
  }.bind(this))
123
125
  }
124
126
 
@@ -29,6 +29,8 @@ describe('GOVUK.Analytics', function () {
29
29
 
30
30
  it('configures a universal tracker', function () {
31
31
  expect(universalSetupArguments[0]).toEqual(['create', 'universal-id', {cookieDomain: '.www.gov.uk', siteSpeedSampleRate: 100}])
32
+ expect(universalSetupArguments[1]).toEqual(['set', 'anonymizeIp', true])
33
+ expect(universalSetupArguments[2]).toEqual(['set', 'displayFeaturesTask', null])
32
34
  })
33
35
  })
34
36
 
@@ -69,6 +71,7 @@ describe('GOVUK.Analytics', function () {
69
71
  expect(allArgs).toContain(['linker:autoLink', ['www.example.com']])
70
72
  expect(allArgs).toContain(['test.linker:autoLink', ['www.example.com']])
71
73
  expect(allArgs).toContain(['test.set', 'anonymizeIp', true])
74
+ expect(allArgs).toContain(['test.set', 'displayFeaturesTask', null])
72
75
  expect(allArgs).toContain(['test.send', 'pageview'])
73
76
  })
74
77
  })
@@ -8,6 +8,14 @@ describe('GOVUK.GOVUKTracker', function () {
8
8
 
9
9
  var tracker
10
10
 
11
+ function setupFakeGa (clientId) {
12
+ window.ga = function (cb) {
13
+ cb({
14
+ get: function () { return clientId }
15
+ })
16
+ }
17
+ }
18
+
11
19
  beforeEach(function () {
12
20
  tracker = new GOVUK.GOVUKTracker('http://www.example.com/a.gif')
13
21
  })
@@ -74,11 +82,22 @@ describe('GOVUK.GOVUKTracker', function () {
74
82
 
75
83
  describe('sendToTracker', function () {
76
84
  it('sends when the DOM is complete', function () {
85
+ setupFakeGa('123456.789012')
86
+
77
87
  spyOn(tracker, 'sendData')
78
88
  tracker.sendToTracker('foo')
79
89
 
80
90
  expect(tracker.sendData).toHaveBeenCalledWith(jasmine.any(Object))
81
91
  })
92
+
93
+ it('sets the ga Client ID', function () {
94
+ setupFakeGa('123456.789012')
95
+
96
+ spyOn(tracker, 'sendData')
97
+ tracker.sendToTracker('foo')
98
+
99
+ expect(tracker.gaClientId).toEqual('123456.789012')
100
+ })
82
101
  })
83
102
 
84
103
  describe('tracking', function () {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_frontend_toolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.0
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Government Digital Service
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-28 00:00:00.000000000 Z
11
+ date: 2017-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails