govuk_frontend_toolkit 7.1.0 → 7.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +2 -2
- data/app/assets/.travis/README.md +1 -1
- data/app/assets/CHANGELOG.md +4 -0
- data/app/assets/VERSION.txt +1 -1
- data/app/assets/create-release.sh +2 -2
- data/app/assets/javascripts/govuk/analytics/external-link-tracker.js +14 -1
- data/app/assets/spec/unit/analytics/external-link-tracker.spec.js +34 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 538b9de6aaf9bd4fa8ec41041f55e19fc38bc25716f2684efde95b3eb5a0e3b9
|
4
|
+
data.tar.gz: 48c37a0f38db00cef1d3472610d5890bc0f7c70938d8b84f9adb01e6ee633ee0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4219bbd88e18c1bd0815f4bb89c38e01723ca3887c6ea1016673f69c3eded8818254053992659f0a0d5ad86825aedbeee190acb901c2a487b5cf9a78608a99a
|
7
|
+
data.tar.gz: 0d6bbce22e7e53064c9d01762f725958827bd68a2fec32c223aefb3d80d32c0fe596b4991e658be4f1861cb1a60e6351dedae60d3b075456719a5de622545d6e
|
data/.travis.yml
CHANGED
@@ -6,8 +6,8 @@ branches:
|
|
6
6
|
before_install:
|
7
7
|
- openssl aes-256-cbc -K $encrypted_839034082a06_key -iv $encrypted_839034082a06_iv -in .travis/govuk_frontend_toolkit_gem_push.enc -out ~/.ssh/id_rsa -d
|
8
8
|
- chmod 600 ~/.ssh/id_rsa
|
9
|
-
- git config --global user.name "GOV.UK
|
10
|
-
- git config --global user.email "
|
9
|
+
- git config --global user.name "GOV.UK Design System CI"
|
10
|
+
- git config --global user.email "design-system-pipeline@digital.cabinet-office.gov.uk"
|
11
11
|
- git remote add origin_ssh git@github.com:alphagov/govuk_frontend_toolkit_gem.git
|
12
12
|
install:
|
13
13
|
- echo "No dependencies to install"
|
@@ -20,4 +20,4 @@ and RubyGems.
|
|
20
20
|
|
21
21
|
The [Travis settings](https://travis-ci.org/alphagov/govuk_frontend_toolkit/settings)
|
22
22
|
contains a Travis token that belongs to
|
23
|
-
[@govuk-
|
23
|
+
[@govuk-design-system-ci](https://github.com/govuk-design-system-ci).
|
data/app/assets/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# 7.2.0
|
2
|
+
|
3
|
+
- Add custom dimension on TrackEvent to duplicate the url information that we normally send on a the `event action`. This will be used to join up with a scheduled custom upload called "External Link Status". We can only join uploads on custom dimensions, not on `event actions`, where we normally add the url info. ([PR #436](alphagov/govuk_frontend_toolkit#436) and [PR #439](alphagov/govuk_frontend_toolkit#439))
|
4
|
+
|
1
5
|
# 7.1.0
|
2
6
|
|
3
7
|
- Promote the details polyfill to Frontend Toolkit from GOV.UK Elements ([PR #426](https://github.com/alphagov/govuk_frontend_toolkit/pull/426)).
|
data/app/assets/VERSION.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.
|
1
|
+
7.2.0
|
@@ -5,8 +5,8 @@ REPO_PATH="alphagov/govuk_frontend_toolkit"
|
|
5
5
|
|
6
6
|
echo "Add config for alphagov/$REPO_PATH"
|
7
7
|
|
8
|
-
git config --global user.name "GOV.UK
|
9
|
-
git config --global user.email "
|
8
|
+
git config --global user.name "GOV.UK Design System CI"
|
9
|
+
git config --global user.email "design-system-pipeline@digital.cabinet-office.gov.uk"
|
10
10
|
git remote add origin_ssh git@github.com:$REPO_PATH.git
|
11
11
|
|
12
12
|
# This openssl command was generated automatically by `travis encrypt-file`, see `.travis/README.md` for more details
|
@@ -5,7 +5,9 @@
|
|
5
5
|
var GOVUK = global.GOVUK || {}
|
6
6
|
|
7
7
|
GOVUK.analyticsPlugins = GOVUK.analyticsPlugins || {}
|
8
|
-
GOVUK.analyticsPlugins.externalLinkTracker = function () {
|
8
|
+
GOVUK.analyticsPlugins.externalLinkTracker = function (options) {
|
9
|
+
options = options || {}
|
10
|
+
var externalLinkUploadCustomDimension = options.externalLinkUploadCustomDimension
|
9
11
|
var currentHost = GOVUK.analyticsPlugins.externalLinkTracker.getHostname()
|
10
12
|
var externalLinkSelector = 'a[href^="http"]:not(a[href*="' + currentHost + '"])'
|
11
13
|
|
@@ -21,6 +23,17 @@
|
|
21
23
|
options.label = linkText
|
22
24
|
}
|
23
25
|
|
26
|
+
if (externalLinkUploadCustomDimension !== undefined) {
|
27
|
+
// This custom dimension will be used to duplicate the url information
|
28
|
+
// that we normally send in an "event action". This will be used to join
|
29
|
+
// up with a scheduled custom upload called "External Link Status".
|
30
|
+
// We can only join uploads on custom dimensions, not on `event actions`
|
31
|
+
// where we normally add the url info.
|
32
|
+
var externalLinkToJoinUploadOn = href
|
33
|
+
|
34
|
+
GOVUK.analytics.setDimension(externalLinkUploadCustomDimension, externalLinkToJoinUploadOn)
|
35
|
+
}
|
36
|
+
|
24
37
|
GOVUK.analytics.trackEvent('External Link Clicked', href, options)
|
25
38
|
}
|
26
39
|
|
@@ -24,10 +24,12 @@ describe('GOVUK.analyticsPlugins.externalLinkTracker', function () {
|
|
24
24
|
|
25
25
|
$('html').on('click', function (evt) { evt.preventDefault() })
|
26
26
|
$('body').append($links)
|
27
|
-
GOVUK.analytics = {
|
27
|
+
GOVUK.analytics = {
|
28
|
+
trackEvent: function () {},
|
29
|
+
setDimension: function () {}
|
30
|
+
}
|
28
31
|
|
29
32
|
spyOn(GOVUK.analyticsPlugins.externalLinkTracker, 'getHostname').and.returnValue('fake-hostname.com')
|
30
|
-
GOVUK.analyticsPlugins.externalLinkTracker()
|
31
33
|
})
|
32
34
|
|
33
35
|
afterEach(function () {
|
@@ -38,6 +40,8 @@ describe('GOVUK.analyticsPlugins.externalLinkTracker', function () {
|
|
38
40
|
})
|
39
41
|
|
40
42
|
it('listens to click events on only external links', function () {
|
43
|
+
GOVUK.analyticsPlugins.externalLinkTracker({externalLinkUploadCustomDimension: 36})
|
44
|
+
|
41
45
|
spyOn(GOVUK.analytics, 'trackEvent')
|
42
46
|
|
43
47
|
$('.external-links a').each(function () {
|
@@ -54,6 +58,8 @@ describe('GOVUK.analyticsPlugins.externalLinkTracker', function () {
|
|
54
58
|
})
|
55
59
|
|
56
60
|
it('listens to click events on elements within external links', function () {
|
61
|
+
GOVUK.analyticsPlugins.externalLinkTracker({externalLinkUploadCustomDimension: 36})
|
62
|
+
|
57
63
|
spyOn(GOVUK.analytics, 'trackEvent')
|
58
64
|
|
59
65
|
$('.external-links a img').trigger('click')
|
@@ -62,6 +68,8 @@ describe('GOVUK.analyticsPlugins.externalLinkTracker', function () {
|
|
62
68
|
})
|
63
69
|
|
64
70
|
it('tracks an external link\'s href and link text', function () {
|
71
|
+
GOVUK.analyticsPlugins.externalLinkTracker({externalLinkUploadCustomDimension: 36})
|
72
|
+
|
65
73
|
spyOn(GOVUK.analytics, 'trackEvent')
|
66
74
|
$('.external-links a').trigger('click')
|
67
75
|
|
@@ -74,4 +82,28 @@ describe('GOVUK.analyticsPlugins.externalLinkTracker', function () {
|
|
74
82
|
expect(GOVUK.analytics.trackEvent).toHaveBeenCalledWith(
|
75
83
|
'External Link Clicked', 'https://www.nationalarchives.gov.uk/one.pdf', {transport: 'beacon', label: 'National Archives PDF'})
|
76
84
|
})
|
85
|
+
|
86
|
+
it('duplicates the url info in a custom dimension to be used to join with a Google Analytics upload', function () {
|
87
|
+
GOVUK.analyticsPlugins.externalLinkTracker({externalLinkUploadCustomDimension: 36})
|
88
|
+
|
89
|
+
spyOn(GOVUK.analytics, 'setDimension')
|
90
|
+
spyOn(GOVUK.analytics, 'trackEvent')
|
91
|
+
$('.external-links a').trigger('click')
|
92
|
+
|
93
|
+
expect(GOVUK.analytics.setDimension).toHaveBeenCalledWith(36, 'http://www.nationalarchives.gov.uk')
|
94
|
+
expect(GOVUK.analytics.trackEvent).toHaveBeenCalledWith(
|
95
|
+
'External Link Clicked', 'http://www.nationalarchives.gov.uk', {transport: 'beacon', label: 'National Archives'})
|
96
|
+
})
|
97
|
+
|
98
|
+
it('does not duplicate the url info if a custom dimension is not provided', function () {
|
99
|
+
GOVUK.analyticsPlugins.externalLinkTracker()
|
100
|
+
|
101
|
+
spyOn(GOVUK.analytics, 'setDimension')
|
102
|
+
spyOn(GOVUK.analytics, 'trackEvent')
|
103
|
+
$('.external-links a').trigger('click')
|
104
|
+
|
105
|
+
expect(GOVUK.analytics.setDimension).not.toHaveBeenCalled()
|
106
|
+
expect(GOVUK.analytics.trackEvent).toHaveBeenCalledWith(
|
107
|
+
'External Link Clicked', 'http://www.nationalarchives.gov.uk', {transport: 'beacon', label: 'National Archives'})
|
108
|
+
})
|
77
109
|
})
|
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: 7.
|
4
|
+
version: 7.2.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-
|
11
|
+
date: 2017-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -305,7 +305,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
305
305
|
version: '0'
|
306
306
|
requirements: []
|
307
307
|
rubyforge_project:
|
308
|
-
rubygems_version: 2.
|
308
|
+
rubygems_version: 2.7.2
|
309
309
|
signing_key:
|
310
310
|
specification_version: 4
|
311
311
|
summary: Tools for building frontend applications
|