govuk_publishing_components 35.23.0 → 36.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-auto-tracker.js +1 -5
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-core.js +27 -41
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-event-tracker.js +6 -10
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-form-tracker.js +1 -4
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-link-tracker.js +1 -5
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-page-views.js +6 -17
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-print-intent-tracker.js +1 -3
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-schemas.js +4 -20
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-scroll-tracker.js +1 -3
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-specialist-link-tracker.js +1 -5
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-video-tracker.js +1 -4
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/pii-remover.js +22 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss +3 -79
- data/app/views/govuk_publishing_components/components/_action_link.html.erb +2 -19
- data/app/views/govuk_publishing_components/components/_option_select.html.erb +17 -15
- data/app/views/govuk_publishing_components/components/docs/action_link.yml +1 -52
- data/app/views/govuk_publishing_components/components/docs/option_select.yml +1 -0
- data/lib/govuk_publishing_components/presenters/component_wrapper_helper.rb +1 -1
- data/lib/govuk_publishing_components/presenters/meta_tags.rb +21 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +2 -10
- data/app/assets/images/govuk_publishing_components/action-link--nhs.png +0 -0
- data/app/assets/images/govuk_publishing_components/action-link--nhs.svg +0 -1
- data/app/assets/images/govuk_publishing_components/action-link-arrow--blue.png +0 -0
- data/app/assets/images/govuk_publishing_components/action-link-arrow--blue.svg +0 -9
- data/app/assets/images/govuk_publishing_components/action-link-arrow--brexit.svg +0 -3
- data/app/assets/images/govuk_publishing_components/action-link-arrow--transparent.svg +0 -1
- data/app/assets/images/govuk_publishing_components/action-link-arrow--white.png +0 -0
- data/app/assets/images/govuk_publishing_components/action-link-arrow--white.svg +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d41ddf9d28242ee496fbf50b88e10bbf1785c27ed809bb8ee40a9cb099092068
|
4
|
+
data.tar.gz: 72d8c532895124b04ffedc228c0baffaa180828f1765d75a7cc792b4969f6ceb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddd6e3b7b2dcb71844e37cb5065aea4c331c0a4e0bbf7daa38e52a9b4161bde2edea212ac24553e74df5d5b599346a8f4e72b853a1a3eb99413fec316519497b
|
7
|
+
data.tar.gz: bd76e4fbb84e10bd6d20b55bd46e499431d52b9dd794b1b152065f63798d922587b9ef22d8fca9a9b3fe6d5e77d5387ddfbd52e0dcde86b7a1bfe5948ecfcd84
|
@@ -35,12 +35,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
35
35
|
console.error('GA4 configuration error: ' + e.message, window.location)
|
36
36
|
return
|
37
37
|
}
|
38
|
-
|
39
38
|
data.text = this.PIIRemover.stripPIIWithOverride(data.text, true, true)
|
40
|
-
|
41
|
-
var schema = schemas.mergeProperties(data, 'event_data')
|
42
|
-
|
43
|
-
window.GOVUK.analyticsGa4.core.sendData(schema)
|
39
|
+
window.GOVUK.analyticsGa4.core.applySchemaAndSendData(data, 'event_data')
|
44
40
|
}
|
45
41
|
}
|
46
42
|
|
@@ -35,20 +35,35 @@ window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {};
|
|
35
35
|
},
|
36
36
|
|
37
37
|
sendData: function (data) {
|
38
|
-
// Prevent any GA4 data being sent during Smokey tests
|
39
|
-
if (this.getUserAgent() === 'Smokey Test / Ruby') {
|
40
|
-
return
|
41
|
-
}
|
42
|
-
|
43
38
|
data.govuk_gem_version = this.getGemVersion()
|
44
39
|
// set this in the console as a debugging aid
|
45
40
|
if (window.GOVUK.analyticsGa4.showDebug) {
|
46
|
-
|
41
|
+
if (data.event_data) {
|
42
|
+
data.event_data = this.sortEventData(data.event_data)
|
43
|
+
} else if (data.page_view) {
|
44
|
+
data.page_view = this.sortEventData(data.page_view)
|
45
|
+
} else if (data.search_results) {
|
46
|
+
data.search_results = this.sortEventData(data.search_results)
|
47
|
+
}
|
47
48
|
console.info(JSON.stringify(data, null, ' '))
|
48
49
|
}
|
50
|
+
|
51
|
+
// Send GA4 data to a fake dataLayer if smokey_cachebust or disable_ga4 is in the query string. Used to prevent Smokey/other tests from spamming our analytics.
|
52
|
+
if (this.trackFunctions.getSearch().match(/[?&](disable_ga4|smokey_cachebust){1}/)) {
|
53
|
+
window.fakeDataLayer = window.fakeDataLayer || []
|
54
|
+
window.fakeDataLayer.push(data)
|
55
|
+
return
|
56
|
+
}
|
57
|
+
|
49
58
|
window.dataLayer.push(data)
|
50
59
|
},
|
51
60
|
|
61
|
+
applySchemaAndSendData: function (data, name) {
|
62
|
+
var schemas = new window.GOVUK.analyticsGa4.Schemas()
|
63
|
+
var schema = schemas.mergeProperties(data, name)
|
64
|
+
this.sendData(schema)
|
65
|
+
},
|
66
|
+
|
52
67
|
getGemVersion: function () {
|
53
68
|
return window.GOVUK.analyticsGa4.vars.gem_version || 'not found'
|
54
69
|
},
|
@@ -74,6 +89,10 @@ window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {};
|
|
74
89
|
return /^(http:||https:)?(\/\/)([^\/]*)/ // eslint-disable-line no-useless-escape
|
75
90
|
},
|
76
91
|
|
92
|
+
getSearch: function () {
|
93
|
+
return window.location.search
|
94
|
+
},
|
95
|
+
|
77
96
|
findTrackingAttributes: function (clicked, trackingTrigger) {
|
78
97
|
if (clicked.hasAttribute('[' + trackingTrigger + ']')) {
|
79
98
|
return clicked
|
@@ -82,39 +101,6 @@ window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {};
|
|
82
101
|
}
|
83
102
|
},
|
84
103
|
|
85
|
-
// create an object to split up long URLs and get around the 100 character limit on GTM data
|
86
|
-
// this gets reassembled in GA4
|
87
|
-
populateLinkPathParts: function (href) {
|
88
|
-
var path = ''
|
89
|
-
if (this.hrefIsRelative(href) || this.isMailToLink(href)) {
|
90
|
-
path = href
|
91
|
-
} else {
|
92
|
-
// This regex matches a protocol and domain name at the start of a string such as https://www.gov.uk, http://gov.uk, //gov.uk
|
93
|
-
path = href.replace(/^(http:||https:)?(\/\/)([^\/]*)/, '') // eslint-disable-line no-useless-escape
|
94
|
-
}
|
95
|
-
|
96
|
-
if (path === '/' || path.length === 0) {
|
97
|
-
return
|
98
|
-
}
|
99
|
-
|
100
|
-
return this.splitStringIntoParts(path)
|
101
|
-
},
|
102
|
-
|
103
|
-
splitStringIntoParts: function (string) {
|
104
|
-
/*
|
105
|
-
This will create an object with 5 keys that are indexes ("1", "2", etc.)
|
106
|
-
The values will be each part of the string split every 100 characters, or undefined.
|
107
|
-
For example: {"1": "/hello/world/etc...", "2": "/more/path/text...", "3": undefined, "4": undefined, "5": undefined}
|
108
|
-
Undefined values are needed to override the persistent object in GTM so that any values from old pushes are overwritten.
|
109
|
-
*/
|
110
|
-
var parts = string.match(/.{1,100}/g)
|
111
|
-
var obj = {}
|
112
|
-
for (var i = 0; i < 5; i++) {
|
113
|
-
obj[(i + 1).toString()] = parts[i]
|
114
|
-
}
|
115
|
-
return obj
|
116
|
-
},
|
117
|
-
|
118
104
|
hrefIsRelative: function (href) {
|
119
105
|
// Checks that a href is relative by the lack of http:, https:// or // at the start of the href.
|
120
106
|
var domain = this.getDomainRegex().exec(href)
|
@@ -261,8 +247,8 @@ window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {};
|
|
261
247
|
var totalLinks = 0
|
262
248
|
for (var i = 0; i < links.length; i++) {
|
263
249
|
var link = links[i]
|
264
|
-
//
|
265
|
-
if (link.getAttribute('data-ga4-ecommerce-path') || link.getAttribute('data-ga4-do-not-index') !== null) {
|
250
|
+
// Ignore links that don't have a href, have a data-ga4-do-not-index attribute on them, or are search result links.
|
251
|
+
if (!link.getAttribute('href') || link.getAttribute('data-ga4-ecommerce-path') || link.getAttribute('data-ga4-do-not-index') !== null) {
|
266
252
|
continue
|
267
253
|
}
|
268
254
|
totalLinks++
|
@@ -43,9 +43,6 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
43
43
|
var text = data.text || event.target.textContent
|
44
44
|
data.text = window.GOVUK.analyticsGa4.core.trackFunctions.removeLinesAndExtraSpaces(text)
|
45
45
|
|
46
|
-
var schemas = new window.GOVUK.analyticsGa4.Schemas()
|
47
|
-
var schema = schemas.mergeProperties(data, 'event_data')
|
48
|
-
|
49
46
|
/* Ensure it only tracks aria-expanded in an element with data-ga4-expandable on it. */
|
50
47
|
if (target.closest('[data-ga4-expandable]')) {
|
51
48
|
var ariaExpanded = this.getClosestAttribute(target, 'aria-expanded')
|
@@ -59,12 +56,12 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
59
56
|
var detailsElement = target.closest('details')
|
60
57
|
|
61
58
|
if (ariaExpanded) {
|
62
|
-
|
63
|
-
|
59
|
+
data.text = data.text || target.innerText
|
60
|
+
data.action = (ariaExpanded === 'false') ? 'opened' : 'closed'
|
64
61
|
} else if (detailsElement) {
|
65
|
-
|
62
|
+
data.text = data.text || detailsElement.textContent
|
66
63
|
var openAttribute = detailsElement.getAttribute('open')
|
67
|
-
|
64
|
+
data.action = (openAttribute == null) ? 'opened' : 'closed'
|
68
65
|
}
|
69
66
|
|
70
67
|
/* If a tab was clicked, grab the href of the clicked tab (usually an anchor # link) */
|
@@ -74,12 +71,11 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
74
71
|
if (aTag) {
|
75
72
|
var href = aTag.getAttribute('href')
|
76
73
|
if (href) {
|
77
|
-
|
74
|
+
data.url = window.GOVUK.analyticsGa4.core.trackFunctions.appendPathToAnchorLinks(href)
|
78
75
|
}
|
79
76
|
}
|
80
77
|
}
|
81
|
-
|
82
|
-
window.GOVUK.analyticsGa4.core.sendData(schema)
|
78
|
+
window.GOVUK.analyticsGa4.core.applySchemaAndSendData(data, 'event_data')
|
83
79
|
}
|
84
80
|
}
|
85
81
|
|
@@ -50,10 +50,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
50
50
|
data.text = data.text.toLowerCase()
|
51
51
|
data.text = window.GOVUK.analyticsGa4.core.trackFunctions.removeLinesAndExtraSpaces(data.text)
|
52
52
|
}
|
53
|
-
|
54
|
-
var schemas = new window.GOVUK.analyticsGa4.Schemas()
|
55
|
-
var schema = schemas.mergeProperties(data, 'event_data')
|
56
|
-
window.GOVUK.analyticsGa4.core.sendData(schema)
|
53
|
+
window.GOVUK.analyticsGa4.core.applySchemaAndSendData(data, 'event_data')
|
57
54
|
}
|
58
55
|
}
|
59
56
|
|
@@ -90,7 +90,6 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
90
90
|
data.url = trackFunctions.applyRedactionIfRequired(this.PIIRemover, element, data.url)
|
91
91
|
data.url = trackFunctions.appendPathToAnchorLinks(data.url)
|
92
92
|
data.link_domain = trackFunctions.populateLinkDomain(data.url)
|
93
|
-
data.link_path_parts = trackFunctions.populateLinkPathParts(data.url)
|
94
93
|
data.method = trackFunctions.getClickType(event)
|
95
94
|
data.external = trackFunctions.isExternalLink(data.url) ? 'true' : 'false'
|
96
95
|
data.index = this.setIndex(data.index, event.target)
|
@@ -106,10 +105,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
106
105
|
if (data.type === 'smart answer' && data.action === 'change response') {
|
107
106
|
data.section = this.PIIRemover.stripPIIWithOverride(data.section, true, true)
|
108
107
|
}
|
109
|
-
|
110
|
-
var schemas = new window.GOVUK.analyticsGa4.Schemas()
|
111
|
-
var schema = schemas.mergeProperties(data, 'event_data')
|
112
|
-
window.GOVUK.analyticsGa4.core.sendData(schema)
|
108
|
+
window.GOVUK.analyticsGa4.core.applySchemaAndSendData(data, 'event_data')
|
113
109
|
}
|
114
110
|
}
|
115
111
|
|
@@ -36,8 +36,8 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
|
|
36
36
|
taxonomy_level1: this.getMetaContent('themes'),
|
37
37
|
taxonomy_main: this.getMetaContent('taxon-slug'),
|
38
38
|
taxonomy_main_id: this.getMetaContent('taxon-id'),
|
39
|
-
taxonomy_all: this.
|
40
|
-
taxonomy_all_ids: this.
|
39
|
+
taxonomy_all: this.getMetaContent('taxon-slugs'),
|
40
|
+
taxonomy_all_ids: this.getMetaContent('taxon-ids'),
|
41
41
|
|
42
42
|
language: this.getLanguage(),
|
43
43
|
history: this.getHistory(),
|
@@ -45,8 +45,8 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
|
|
45
45
|
first_published_at: this.stripTimeFrom(this.getMetaContent('first-published-at')),
|
46
46
|
updated_at: this.stripTimeFrom(this.getMetaContent('updated-at')),
|
47
47
|
public_updated_at: this.stripTimeFrom(this.getMetaContent('public-updated-at')),
|
48
|
-
publishing_government: this.getMetaContent('publishing-government'),
|
49
|
-
political_status: this.getMetaContent('political-status'),
|
48
|
+
publishing_government: this.getMetaContent('publishing-government') || this.getMetaContent('ga4-publishing-government'),
|
49
|
+
political_status: this.getMetaContent('political-status') || this.getMetaContent('ga4-political-status'),
|
50
50
|
primary_publishing_organisation: this.getMetaContent('primary-publishing-organisation'),
|
51
51
|
organisations: this.getMetaContent('analytics:organisations'),
|
52
52
|
world_locations: this.getMetaContent('analytics:world-locations'),
|
@@ -73,12 +73,8 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
|
|
73
73
|
return this.PIIRemover.stripPIIWithOverride(this.stripGaParam(document.location.href), true, true)
|
74
74
|
},
|
75
75
|
|
76
|
-
getSearch: function () {
|
77
|
-
return window.location.search
|
78
|
-
},
|
79
|
-
|
80
76
|
getSearchTerm: function () {
|
81
|
-
var queryString =
|
77
|
+
var queryString = window.GOVUK.analyticsGa4.core.trackFunctions.getSearch()
|
82
78
|
|
83
79
|
if (!queryString) {
|
84
80
|
return undefined
|
@@ -97,7 +93,7 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
|
|
97
93
|
},
|
98
94
|
|
99
95
|
getQueryString: function () {
|
100
|
-
var queryString =
|
96
|
+
var queryString = window.GOVUK.analyticsGa4.core.trackFunctions.getSearch()
|
101
97
|
if (queryString) {
|
102
98
|
queryString = this.stripGaParam(queryString)
|
103
99
|
queryString = this.PIIRemover.stripPIIWithOverride(queryString, true, true)
|
@@ -200,13 +196,6 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
|
|
200
196
|
return undefined
|
201
197
|
},
|
202
198
|
|
203
|
-
splitLongMetaContent: function (metatag) {
|
204
|
-
var tag = this.getMetaContent(metatag)
|
205
|
-
if (tag) {
|
206
|
-
return window.GOVUK.analyticsGa4.core.trackFunctions.splitStringIntoParts(tag)
|
207
|
-
}
|
208
|
-
},
|
209
|
-
|
210
199
|
// return only the date from given timestamps of the form
|
211
200
|
// 2022-03-28T19:11:00.000+00:00
|
212
201
|
stripTimeFrom: function (value) {
|
data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-print-intent-tracker.js
CHANGED
@@ -13,9 +13,7 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
|
|
13
13
|
type: 'print page',
|
14
14
|
method: 'browser print'
|
15
15
|
}
|
16
|
-
|
17
|
-
schema = schema.mergeProperties(data, 'event_data')
|
18
|
-
window.GOVUK.analyticsGa4.core.sendData(schema)
|
16
|
+
window.GOVUK.analyticsGa4.core.applySchemaAndSendData(data, 'event_data')
|
19
17
|
})
|
20
18
|
}
|
21
19
|
}
|
@@ -27,7 +27,6 @@
|
|
27
27
|
external: this.undefined,
|
28
28
|
method: this.undefined,
|
29
29
|
link_domain: this.undefined,
|
30
|
-
link_path_parts: this.undefined,
|
31
30
|
tool_name: this.undefined,
|
32
31
|
percent_scrolled: this.undefined,
|
33
32
|
video_current_time: this.undefined,
|
@@ -53,48 +52,33 @@
|
|
53
52
|
}
|
54
53
|
}
|
55
54
|
|
56
|
-
// merge data attributes
|
57
|
-
// only allow it if it already exists in the schema
|
55
|
+
// merge allowed data attributes into the event schema
|
58
56
|
Schemas.prototype.mergeProperties = function (data, eventAttribute) {
|
59
57
|
var schema = this.eventSchema()
|
60
58
|
schema.event = eventAttribute
|
61
|
-
// exceptions should be inserted without checking for sub parameters
|
62
|
-
// exceptions should only come from code, not directly from data attributes
|
63
|
-
// e.g. link_path_parts is generated by JS and contains potentially non-unique
|
64
|
-
// sub parameter names i.e. '1', '2'
|
65
|
-
var exceptions = ['link_path_parts']
|
66
59
|
|
67
60
|
for (var property in data) {
|
68
61
|
// some passed data might be undefined, don't want it to overwrite e.g. the index sub parameters
|
69
62
|
if (data[property] !== undefined) {
|
70
|
-
|
71
|
-
schema.event_data = this.addToObject(schema.event_data, property, data[property])
|
72
|
-
} else {
|
73
|
-
// we check for one level of nesting in the data attributes data
|
74
|
-
// this check can be removed once nesting is removed from all data attributes
|
75
|
-
for (var subproperty in data[property]) {
|
76
|
-
schema.event_data = this.addToObject(schema.event_data, subproperty, data[property][subproperty])
|
77
|
-
}
|
78
|
-
}
|
63
|
+
schema.event_data = this.addToObject(schema.event_data, property, data[property])
|
79
64
|
}
|
80
65
|
}
|
81
66
|
return schema
|
82
67
|
}
|
83
68
|
|
84
|
-
// might be easier to check if it's not a string or a number?
|
85
69
|
Schemas.prototype.isAnObject = function (item) {
|
86
70
|
if (typeof item === 'object' && !Array.isArray(item) && item !== null) {
|
87
71
|
return true
|
88
72
|
}
|
89
73
|
}
|
90
74
|
|
91
|
-
// given an object and a key, insert a value into
|
92
|
-
// we check for one level of nesting in the object
|
75
|
+
// given an object and a key, insert a value into object[key] if it exists
|
93
76
|
Schemas.prototype.addToObject = function (obj, key, value) {
|
94
77
|
if (key in obj) {
|
95
78
|
obj[key] = value
|
96
79
|
return obj
|
97
80
|
} else {
|
81
|
+
// check for one level of nesting in the object
|
98
82
|
for (var property in obj) {
|
99
83
|
if (this.isAnObject(obj[property])) {
|
100
84
|
if (key in obj[property]) {
|
@@ -123,9 +123,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
123
123
|
// following will be undefined if tracking headings
|
124
124
|
data.percent_scrolled = node.eventData.percent_scrolled
|
125
125
|
|
126
|
-
|
127
|
-
var schema = schemas.mergeProperties(data, 'event_data')
|
128
|
-
window.GOVUK.analyticsGa4.core.sendData(schema)
|
126
|
+
window.GOVUK.analyticsGa4.core.applySchemaAndSendData(data, 'event_data')
|
129
127
|
}
|
130
128
|
}
|
131
129
|
}
|
data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-specialist-link-tracker.js
CHANGED
@@ -72,7 +72,6 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
|
|
72
72
|
if (data.url) {
|
73
73
|
data.url = window.GOVUK.analyticsGa4.core.trackFunctions.removeCrossDomainParams(data.url)
|
74
74
|
data.link_domain = window.GOVUK.analyticsGa4.core.trackFunctions.populateLinkDomain(data.url)
|
75
|
-
data.link_path_parts = window.GOVUK.analyticsGa4.core.trackFunctions.populateLinkPathParts(data.url)
|
76
75
|
}
|
77
76
|
|
78
77
|
data.text = window.GOVUK.analyticsGa4.core.trackFunctions.removeLinesAndExtraSpaces(element.textContent)
|
@@ -81,10 +80,7 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
|
|
81
80
|
data.text = 'image'
|
82
81
|
}
|
83
82
|
data.method = window.GOVUK.analyticsGa4.core.trackFunctions.getClickType(event)
|
84
|
-
|
85
|
-
var schemas = new window.GOVUK.analyticsGa4.Schemas()
|
86
|
-
var schema = schemas.mergeProperties(data, 'event_data')
|
87
|
-
window.GOVUK.analyticsGa4.core.sendData(schema)
|
83
|
+
window.GOVUK.analyticsGa4.core.applySchemaAndSendData(data, 'event_data')
|
88
84
|
}
|
89
85
|
},
|
90
86
|
|
@@ -81,10 +81,7 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
|
|
81
81
|
data.video_duration = this.handlers['video-' + player.id + '-duration']
|
82
82
|
data.video_percent = position
|
83
83
|
|
84
|
-
|
85
|
-
var schema = schemas.mergeProperties(data, 'event_data')
|
86
|
-
|
87
|
-
window.GOVUK.analyticsGa4.core.sendData(schema)
|
84
|
+
window.GOVUK.analyticsGa4.core.applySchemaAndSendData(data, 'event_data')
|
88
85
|
},
|
89
86
|
|
90
87
|
cleanVideoUrl: function (url) {
|
@@ -4,8 +4,22 @@
|
|
4
4
|
var GOVUK = global.GOVUK || {}
|
5
5
|
var EMAIL_PATTERN = /[^\s=/?&#+]+(?:@|%40)[^\s=/?&+]+/g
|
6
6
|
var POSTCODE_PATTERN = /\b[A-PR-UWYZ][A-HJ-Z]?[0-9][0-9A-HJKMNPR-Y]?(?:[\s+]|%20)*[0-9](?!refund)[ABD-HJLNPQ-Z]{2,3}\b/gi
|
7
|
-
|
8
|
-
|
7
|
+
|
8
|
+
// e.g. 01/01/1990 or 01-01-1990 or 1-1-1990 or 1/1/1990 or 01\01\1990 or 1\1\1990
|
9
|
+
var DATE_PATTERN_NUMERIC_1 = /\d{1,2}([-\/\\])\d{1,2}([-\/\\])\d{4}/g // eslint-disable-line no-useless-escape
|
10
|
+
|
11
|
+
// e.g. 1990/01/01 or 1990-01-01 or 1990-1-1 or 1990/1/1 or 1990\1\1 or 1990\01\01
|
12
|
+
var DATE_PATTERN_NUMERIC_2 = /\d{4}([-\/\\])\d{1,2}([-\/\\])\d{1,2}/g // eslint-disable-line no-useless-escape
|
13
|
+
|
14
|
+
// e.g. 12345678 (This originated from the UA PII Remover)
|
15
|
+
var DATE_PATTERN_NUMERIC_3 = /[0-9]{8}/g
|
16
|
+
|
17
|
+
// e.g. 1(st) (of) Jan(uary) 1990 (or 90 or '90) - where the bracketed characters are optional parts that can be matched
|
18
|
+
var DATE_PATTERN_STRING_1 = /\d{1,2}(?:st|nd|rd|th)?\s(?:of\s)?(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:t)?(?:ember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s(?:')?(\d{4}|\d{2})/gi
|
19
|
+
|
20
|
+
// e.g. Jan(uary) 1(st) 1990 (or 90 or '90) - where the bracketed characters are optional parts that can be matched
|
21
|
+
var DATE_PATTERN_STRING_2 = /(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:t)?(?:ember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s\d{1,2}?(?:st|nd|rd|th)?\s(?:')?(\d{4}|\d{2})/gi
|
22
|
+
|
9
23
|
var ESCAPE_REGEX_PATTERN = /[|\\{}()[\]^$+*?.]/g
|
10
24
|
|
11
25
|
// specific URL parameters to be redacted from accounts URLs
|
@@ -86,8 +100,12 @@
|
|
86
100
|
stripped = this.stripQueryStringParameters(stripped)
|
87
101
|
|
88
102
|
if (this.stripDatePII === true) {
|
89
|
-
|
90
|
-
stripped = stripped.replace(
|
103
|
+
var DATE_REDACTION_STRING = '[date]'
|
104
|
+
stripped = stripped.replace(DATE_PATTERN_NUMERIC_1, DATE_REDACTION_STRING)
|
105
|
+
stripped = stripped.replace(DATE_PATTERN_NUMERIC_2, DATE_REDACTION_STRING)
|
106
|
+
stripped = stripped.replace(DATE_PATTERN_NUMERIC_3, DATE_REDACTION_STRING)
|
107
|
+
stripped = stripped.replace(DATE_PATTERN_STRING_1, DATE_REDACTION_STRING)
|
108
|
+
stripped = stripped.replace(DATE_PATTERN_STRING_2, DATE_REDACTION_STRING)
|
91
109
|
}
|
92
110
|
if (this.stripPostcodePII === true) {
|
93
111
|
stripped = stripped.replace(POSTCODE_PATTERN, '[postcode]')
|
@@ -94,31 +94,6 @@
|
|
94
94
|
}
|
95
95
|
}
|
96
96
|
|
97
|
-
.gem-c-action-link--white-arrow {
|
98
|
-
&::before {
|
99
|
-
background-image: image-url("govuk_publishing_components/action-link-arrow--white.png");
|
100
|
-
background-image: image-url("govuk_publishing_components/action-link-arrow--white.svg"), linear-gradient(transparent, transparent);
|
101
|
-
}
|
102
|
-
}
|
103
|
-
|
104
|
-
.gem-c-action-link--blue-arrow {
|
105
|
-
&::before {
|
106
|
-
width: 36px;
|
107
|
-
height: 28px;
|
108
|
-
background: image-url("govuk_publishing_components/action-link-arrow--blue.png");
|
109
|
-
background: image-url("govuk_publishing_components/action-link-arrow--blue.svg"), linear-gradient(transparent, transparent);
|
110
|
-
background-repeat: no-repeat;
|
111
|
-
background-size: 28px auto;
|
112
|
-
background-position: 0 0;
|
113
|
-
|
114
|
-
@include govuk-media-query($from: tablet) {
|
115
|
-
width: 45px;
|
116
|
-
height: 35px;
|
117
|
-
background-size: 35px auto;
|
118
|
-
}
|
119
|
-
}
|
120
|
-
}
|
121
|
-
|
122
97
|
.gem-c-action-link--simple {
|
123
98
|
&::before {
|
124
99
|
width: 30px;
|
@@ -143,13 +118,6 @@
|
|
143
118
|
}
|
144
119
|
}
|
145
120
|
|
146
|
-
.gem-c-action-link--dark-icon {
|
147
|
-
&::before {
|
148
|
-
background: image-url("govuk_publishing_components/action-link-arrow--dark.png");
|
149
|
-
background: image-url("govuk_publishing_components/action-link-arrow--dark.svg"), linear-gradient(transparent, transparent);
|
150
|
-
}
|
151
|
-
}
|
152
|
-
|
153
121
|
.gem-c-action-link--dark-large-icon {
|
154
122
|
&::before {
|
155
123
|
background: image-url("govuk_publishing_components/action-link-arrow--dark.png");
|
@@ -184,8 +152,7 @@
|
|
184
152
|
}
|
185
153
|
}
|
186
154
|
|
187
|
-
.gem-c-action-link--dark-icon
|
188
|
-
.gem-c-action-link--small-icon {
|
155
|
+
.gem-c-action-link--dark-icon {
|
189
156
|
max-width: none;
|
190
157
|
|
191
158
|
@include govuk-media-query($until: tablet) {
|
@@ -195,57 +162,14 @@
|
|
195
162
|
&::before {
|
196
163
|
height: 30px;
|
197
164
|
width: 35px;
|
165
|
+
background: image-url("govuk_publishing_components/action-link-arrow--dark.png");
|
166
|
+
background: image-url("govuk_publishing_components/action-link-arrow--dark.svg"), linear-gradient(transparent, transparent);
|
198
167
|
background-repeat: no-repeat;
|
199
168
|
background-size: 25px auto;
|
200
169
|
background-position: 0 2px;
|
201
170
|
}
|
202
171
|
}
|
203
172
|
|
204
|
-
.gem-c-action-link--transparent-icon {
|
205
|
-
&::before {
|
206
|
-
background-image: image-url("govuk_publishing_components/action-link-arrow--transparent.svg");
|
207
|
-
}
|
208
|
-
}
|
209
|
-
|
210
|
-
.gem-c-action-link--brexit {
|
211
|
-
max-width: none;
|
212
|
-
|
213
|
-
&::before {
|
214
|
-
height: 30px;
|
215
|
-
width: 30px;
|
216
|
-
background-image: image-url("govuk_publishing_components/action-link-arrow--brexit.svg");
|
217
|
-
background-repeat: no-repeat;
|
218
|
-
background-size: 18px auto;
|
219
|
-
background-position: 0 2px;
|
220
|
-
}
|
221
|
-
|
222
|
-
@include govuk-media-query($until: tablet) {
|
223
|
-
margin-bottom: govuk-spacing(2);
|
224
|
-
}
|
225
|
-
|
226
|
-
@include govuk-media-query($from: tablet) {
|
227
|
-
margin-bottom: govuk-spacing(2);
|
228
|
-
|
229
|
-
&::before {
|
230
|
-
width: 35px;
|
231
|
-
background-position: 0 4px;
|
232
|
-
background-size: 25px auto;
|
233
|
-
}
|
234
|
-
}
|
235
|
-
}
|
236
|
-
|
237
|
-
.gem-c-action-link--nhs {
|
238
|
-
&::before {
|
239
|
-
width: 80px;
|
240
|
-
height: 70px;
|
241
|
-
background: image-url("govuk_publishing_components/action-link--nhs.png");
|
242
|
-
background: image-url("govuk_publishing_components/action-link--nhs.svg"), linear-gradient(transparent, transparent);
|
243
|
-
background-repeat: no-repeat;
|
244
|
-
background-size: 85% auto;
|
245
|
-
background-position: 0 50%;
|
246
|
-
}
|
247
|
-
}
|
248
|
-
|
249
173
|
.gem-c-action-link--light-text {
|
250
174
|
color: govuk-colour("white");
|
251
175
|
|
@@ -11,32 +11,17 @@
|
|
11
11
|
subtext_href ||= false
|
12
12
|
mobile_subtext ||= false
|
13
13
|
light_text ||= false
|
14
|
-
blue_arrow ||= false
|
15
|
-
white_arrow ||= false
|
16
14
|
simple ||= false
|
17
15
|
simple_light ||= false
|
18
16
|
dark_icon ||= false
|
19
17
|
dark_large_icon ||= false
|
20
18
|
light_icon ||= false
|
21
|
-
small_icon ||= false
|
22
|
-
nhs_icon ||= false
|
23
|
-
brexit_icon ||= false
|
24
|
-
transparent_icon ||= false
|
25
|
-
data ||= nil
|
26
|
-
classes ||= nil
|
27
|
-
font_size ||= nil
|
28
19
|
|
29
20
|
css_classes = %w(gem-c-action-link)
|
30
21
|
css_classes << "gem-c-action-link--light-text" if light_text
|
31
22
|
css_classes << "gem-c-action-link--dark-icon" if dark_icon
|
32
23
|
css_classes << "gem-c-action-link--dark-large-icon" if dark_large_icon
|
33
|
-
css_classes << "gem-c-action-link--small-icon" if small_icon
|
34
|
-
css_classes << "gem-c-action-link--transparent-icon" if transparent_icon
|
35
24
|
css_classes << "gem-c-action-link--light-icon" if light_icon
|
36
|
-
css_classes << "gem-c-action-link--nhs" if nhs_icon
|
37
|
-
css_classes << "gem-c-action-link--brexit" if brexit_icon
|
38
|
-
css_classes << "gem-c-action-link--blue-arrow" if blue_arrow
|
39
|
-
css_classes << "gem-c-action-link--white-arrow" if white_arrow
|
40
25
|
css_classes << "gem-c-action-link--simple" if simple
|
41
26
|
css_classes << "gem-c-action-link--simple-light" if simple_light
|
42
27
|
css_classes << "gem-c-action-link--with-subtext" if subtext
|
@@ -44,9 +29,7 @@
|
|
44
29
|
css_classes << shared_helper.get_margin_bottom
|
45
30
|
|
46
31
|
link_classes = %w(govuk-link gem-c-action-link__link)
|
47
|
-
link_classes << shared_helper.classes if classes
|
48
32
|
link_classes << "govuk-link--inverse" if light_text
|
49
|
-
link_classes << shared_helper.get_heading_size(font_size, 'm') if font_size
|
50
33
|
|
51
34
|
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
52
35
|
component_helper.add_class(css_classes.join(" "))
|
@@ -61,7 +44,7 @@
|
|
61
44
|
<% end %>
|
62
45
|
|
63
46
|
<% if href.present? %>
|
64
|
-
<%= link_to href, class: link_classes
|
47
|
+
<%= link_to href, class: link_classes do %>
|
65
48
|
<%= main_text %>
|
66
49
|
<% end %>
|
67
50
|
<% else %>
|
@@ -73,7 +56,7 @@
|
|
73
56
|
<span class="gem-c-action-link__subtext-wrapper">
|
74
57
|
<% if subtext_href %>
|
75
58
|
<%= content_tag(:span, subtext, class: "gem-c-action-link__subtext") do %>
|
76
|
-
<%= link_to subtext, subtext_href, class: link_classes
|
59
|
+
<%= link_to subtext, subtext_href, class: link_classes %>
|
77
60
|
<% end %>
|
78
61
|
<% else %>
|
79
62
|
<%= content_tag(:span, subtext, class: "gem-c-action-link__subtext") %>
|
@@ -7,15 +7,10 @@
|
|
7
7
|
checkboxes_count_id = checkboxes_id + "-count"
|
8
8
|
show_filter ||= false
|
9
9
|
large ||= false
|
10
|
-
|
11
|
-
classes = %w[gem-c-option-select__container js-options-container]
|
12
|
-
classes << "gem-c-option-select__container--large" if large
|
13
10
|
%>
|
14
11
|
|
15
12
|
<% if show_filter %>
|
16
|
-
<%
|
17
|
-
filter_id ||= "input-#{SecureRandom.hex(4)}"
|
18
|
-
%>
|
13
|
+
<% filter_id ||= "input-#{SecureRandom.hex(4)}" %>
|
19
14
|
<% filter = capture do %>
|
20
15
|
<%= tag.label for: filter_id, class: "govuk-label govuk-visually-hidden" do %>
|
21
16
|
Filter <%= title %>
|
@@ -34,20 +29,27 @@
|
|
34
29
|
<% filter_element = CGI::escapeHTML(filter) %>
|
35
30
|
<% end %>
|
36
31
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
32
|
+
<%
|
33
|
+
helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
34
|
+
helper.add_class("gem-c-option-select")
|
35
|
+
helper.add_data_attribute({ module: "option-select" })
|
36
|
+
helper.add_data_attribute({ "closed-on-load": true }) if local_assigns.include?(:closed_on_load) && closed_on_load
|
37
|
+
helper.add_data_attribute({ "closed-on-load-mobile": "true" }) if local_assigns.include?(:closed_on_load_mobile) && closed_on_load_mobile
|
38
|
+
helper.add_data_attribute({ "input-aria-controls": aria_controls_id }) if local_assigns.include?(:aria_controls_id)
|
39
|
+
helper.add_data_attribute({ "filter-element": filter_element }) if show_filter
|
40
|
+
|
41
|
+
options_container_classes = %w[gem-c-option-select__container js-options-container]
|
42
|
+
options_container_classes << "gem-c-option-select__container--large" if large
|
43
|
+
%>
|
44
|
+
|
45
|
+
<%= tag.div(**helper.all_attributes) do %>
|
44
46
|
<h3 class="gem-c-option-select__heading js-container-heading">
|
45
47
|
<span class="gem-c-option-select__title js-container-button" id="<%= title_id %>"><%= title %></span>
|
46
48
|
<svg version="1.1" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="0" height="0" class="gem-c-option-select__icon gem-c-option-select__icon--up" aria-hidden="true" focusable="false"><path d="m798.16 609.84l-256-256c-16.683-16.683-43.691-16.683-60.331 0l-256 256c-16.683 16.683-16.683 43.691 0 60.331s43.691 16.683 60.331 0l225.84-225.84 225.84 225.84c16.683 16.683 43.691 16.683 60.331 0s16.683-43.691 0-60.331z"/></svg>
|
47
49
|
<svg version="1.1" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="0" height="0" class="gem-c-option-select__icon gem-c-option-select__icon--down" aria-hidden="true" focusable="false"><path d="m225.84 414.16l256 256c16.683 16.683 43.691 16.683 60.331 0l256-256c16.683-16.683 16.683-43.691 0-60.331s-43.691-16.683-60.331 0l-225.84 225.84-225.84-225.84c-16.683-16.683-43.691-16.683-60.331 0s-16.683 43.691 0 60.331z"/></svg>
|
48
50
|
</h3>
|
49
51
|
|
50
|
-
<%= content_tag(:div, role: "group", aria: { labelledby: title_id }, class:
|
52
|
+
<%= content_tag(:div, role: "group", aria: { labelledby: title_id }, class: options_container_classes, id: options_container_id, tabindex: "-1") do %>
|
51
53
|
<div class="gem-c-option-select__container-inner js-auto-height-inner">
|
52
54
|
<% if show_filter %>
|
53
55
|
<span id="<%= checkboxes_count_id %>"
|
@@ -68,4 +70,4 @@
|
|
68
70
|
} %>
|
69
71
|
</div>
|
70
72
|
<% end %>
|
71
|
-
|
73
|
+
<% end %>
|
@@ -13,18 +13,6 @@ examples:
|
|
13
13
|
text: Look at this margin
|
14
14
|
href: "/page"
|
15
15
|
margin_bottom: 9
|
16
|
-
with_data_attributes:
|
17
|
-
data:
|
18
|
-
text: "Coronavirus (COVID-19)"
|
19
|
-
href: "/page"
|
20
|
-
data:
|
21
|
-
attr_test: "hasDataAttribute"
|
22
|
-
with_js_classes:
|
23
|
-
description: Use `js-` prefixed classes only as interaction hooks – to query and operate on elements via JavaScript. Classes are added to the link itself.
|
24
|
-
data:
|
25
|
-
text: "Coronavirus (COVID-19)"
|
26
|
-
href: "/page"
|
27
|
-
classes: 'js-hook'
|
28
16
|
with_no_wrapping_text:
|
29
17
|
data:
|
30
18
|
text: "Coronavirus (COVID-19):"
|
@@ -37,14 +25,6 @@ examples:
|
|
37
25
|
light_text: true
|
38
26
|
context:
|
39
27
|
dark_background: true
|
40
|
-
with_transparent_svg:
|
41
|
-
data:
|
42
|
-
text: Find out what you need to do
|
43
|
-
href: "/page"
|
44
|
-
light_text: true
|
45
|
-
transparent_icon: true
|
46
|
-
context:
|
47
|
-
dark_background: true
|
48
28
|
with_subtext:
|
49
29
|
data:
|
50
30
|
text: Emergency something
|
@@ -79,19 +59,6 @@ examples:
|
|
79
59
|
light_text: true
|
80
60
|
context:
|
81
61
|
dark_background: true
|
82
|
-
white_arrow:
|
83
|
-
data:
|
84
|
-
text: Find out how to stay safe and help prevent the spread
|
85
|
-
href: "/something"
|
86
|
-
white_arrow: true
|
87
|
-
light_text: true
|
88
|
-
context:
|
89
|
-
dark_background: true
|
90
|
-
blue_arrow:
|
91
|
-
data:
|
92
|
-
text: Find out how to stay safe and help prevent the spread
|
93
|
-
href: "/something"
|
94
|
-
blue_arrow: true
|
95
62
|
simple_arrow:
|
96
63
|
data:
|
97
64
|
text: Getting financial help and keeping your business safe
|
@@ -105,11 +72,6 @@ examples:
|
|
105
72
|
simple_light: true
|
106
73
|
context:
|
107
74
|
dark_background: true
|
108
|
-
with_small_icon:
|
109
|
-
data:
|
110
|
-
text: Coronavirus (COVID-19)
|
111
|
-
href: "/my-test-page"
|
112
|
-
small_icon: true
|
113
75
|
with_dark_icon:
|
114
76
|
data:
|
115
77
|
text: Coronavirus (COVID-19)
|
@@ -124,17 +86,4 @@ examples:
|
|
124
86
|
data:
|
125
87
|
text: Coronavirus (COVID-19)
|
126
88
|
href: "/my-test-page"
|
127
|
-
light_icon: true
|
128
|
-
with_brexit_icon_and_custom_font_size:
|
129
|
-
data:
|
130
|
-
text: Guidance for businesses
|
131
|
-
href: "/guidance-for-businesses"
|
132
|
-
brexit_icon: true
|
133
|
-
font_size: m
|
134
|
-
with_nhs_icon:
|
135
|
-
data:
|
136
|
-
text: Something about the NHS
|
137
|
-
subtext: Perhaps you'd like to click here
|
138
|
-
subtext_href: "/page"
|
139
|
-
mobile_subtext: true
|
140
|
-
nhs_icon: true
|
89
|
+
light_icon: true
|
@@ -22,6 +22,7 @@ accessibility_criteria: |
|
|
22
22
|
- inform the user that is it an editable field
|
23
23
|
- inform the user when there are matches, or if there are no matches
|
24
24
|
- inform the user as the number of matches changes
|
25
|
+
uses_component_wrapper_helper: true
|
25
26
|
examples:
|
26
27
|
default:
|
27
28
|
data:
|
@@ -76,7 +76,7 @@ module GovukPublishingComponents
|
|
76
76
|
return if classes.blank?
|
77
77
|
|
78
78
|
class_array = classes.split(" ")
|
79
|
-
unless class_array.all? { |c| c.start_with?("js-", "gem-c-", "govuk-", "brand--", "brand__") }
|
79
|
+
unless class_array.all? { |c| c.start_with?("js-", "gem-c-", "govuk-", "app-c-", "brand--", "brand__") }
|
80
80
|
raise(ArgumentError, "Classes (#{classes}) must be prefixed with `js-`")
|
81
81
|
end
|
82
82
|
end
|
@@ -19,6 +19,7 @@ module GovukPublishingComponents
|
|
19
19
|
def meta_tags
|
20
20
|
meta_tags = {}
|
21
21
|
meta_tags = add_core_tags(meta_tags)
|
22
|
+
meta_tags = add_ga4_political_tags(meta_tags)
|
22
23
|
meta_tags = add_organisation_tags(meta_tags)
|
23
24
|
meta_tags = add_political_tags(meta_tags)
|
24
25
|
meta_tags = add_taxonomy_tags(meta_tags)
|
@@ -48,6 +49,8 @@ module GovukPublishingComponents
|
|
48
49
|
primary_publisher = content_item.dig(:links, :primary_publishing_organisation)
|
49
50
|
primary_publisher = primary_publisher.first[:title] unless primary_publisher.blank?
|
50
51
|
meta_tags["govuk:primary-publishing-organisation"] = primary_publisher unless primary_publisher.blank?
|
52
|
+
|
53
|
+
# Some browse topics are nested in the content item, we want to grab these for GA4 tracking.
|
51
54
|
ga4_browse_topic = content_item.dig(:links, :ordered_related_items, 0, :links, :mainstream_browse_pages, 0, :links, :parent, 0, :title)
|
52
55
|
ga4_browse_topic = ga4_browse_topic.downcase if ga4_browse_topic
|
53
56
|
meta_tags["govuk:ga4-browse-topic"] = ga4_browse_topic if ga4_browse_topic
|
@@ -84,6 +87,24 @@ module GovukPublishingComponents
|
|
84
87
|
meta_tags
|
85
88
|
end
|
86
89
|
|
90
|
+
# Some 'government' objects are nested in the content item on some pages. We want to grab these for GA4 tracking.
|
91
|
+
# We only add the publishing government if 'political' is true, otherwise some content items get incorrectly linked to a government
|
92
|
+
def add_ga4_political_tags(meta_tags)
|
93
|
+
government = content_item.dig(:links, :government, 0)
|
94
|
+
|
95
|
+
# political: true/false is in a different place to current: true/false, which is why we have 'details' and 'government[:details]'
|
96
|
+
if government && details[:political]
|
97
|
+
meta_tags["govuk:ga4-political-status"] = government[:details][:current] ? "political" : "historic"
|
98
|
+
|
99
|
+
government_title = government[:title]
|
100
|
+
if government_title && !government[:details][:current]
|
101
|
+
meta_tags["govuk:ga4-publishing-government"] = government_title
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
meta_tags
|
106
|
+
end
|
107
|
+
|
87
108
|
def add_taxonomy_tags(meta_tags)
|
88
109
|
themes = root_taxon_slugs(content_item)
|
89
110
|
meta_tags["govuk:themes"] = themes.to_a.sort.join(", ") unless themes.empty?
|
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:
|
4
|
+
version: 36.0.1
|
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: 2023-11-
|
11
|
+
date: 2023-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_app_config
|
@@ -342,11 +342,6 @@ files:
|
|
342
342
|
- LICENCE.md
|
343
343
|
- README.md
|
344
344
|
- app/assets/config/govuk_publishing_components_manifest.js
|
345
|
-
- app/assets/images/govuk_publishing_components/action-link--nhs.png
|
346
|
-
- app/assets/images/govuk_publishing_components/action-link--nhs.svg
|
347
|
-
- app/assets/images/govuk_publishing_components/action-link-arrow--blue.png
|
348
|
-
- app/assets/images/govuk_publishing_components/action-link-arrow--blue.svg
|
349
|
-
- app/assets/images/govuk_publishing_components/action-link-arrow--brexit.svg
|
350
345
|
- app/assets/images/govuk_publishing_components/action-link-arrow--dark.png
|
351
346
|
- app/assets/images/govuk_publishing_components/action-link-arrow--dark.svg
|
352
347
|
- app/assets/images/govuk_publishing_components/action-link-arrow--light.png
|
@@ -355,9 +350,6 @@ files:
|
|
355
350
|
- app/assets/images/govuk_publishing_components/action-link-arrow--simple-light.svg
|
356
351
|
- app/assets/images/govuk_publishing_components/action-link-arrow--simple.png
|
357
352
|
- app/assets/images/govuk_publishing_components/action-link-arrow--simple.svg
|
358
|
-
- app/assets/images/govuk_publishing_components/action-link-arrow--transparent.svg
|
359
|
-
- app/assets/images/govuk_publishing_components/action-link-arrow--white.png
|
360
|
-
- app/assets/images/govuk_publishing_components/action-link-arrow--white.svg
|
361
353
|
- app/assets/images/govuk_publishing_components/action-link-arrow.png
|
362
354
|
- app/assets/images/govuk_publishing_components/action-link-arrow.svg
|
363
355
|
- app/assets/images/govuk_publishing_components/crests/bis_crest_13px.png
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
<svg fill="none" height="227" viewBox="0 0 227 227" width="227" xmlns="http://www.w3.org/2000/svg"><path d="m55.7 226.5c-30.4 0-55.2-24.8-55.2-55.2v-115.6c0-30.4 24.8-55.2 55.2-55.2h115.6c30.4 0 55.2 24.8 55.2 55.2v115.6c0 30.4-24.8 55.2-55.2 55.2z" fill="#0ba23b"/><path d="m171.3 1c30.2 0 54.7 24.5 54.7 54.7v115.6c0 30.2-24.5 54.7-54.7 54.7h-115.6c-30.2 0-54.7-24.5-54.7-54.7v-115.6c0-30.2 24.5-54.7 54.7-54.7zm0-1h-115.6c-30.7 0-55.7 25-55.7 55.7v115.6c0 30.7 25 55.7 55.7 55.7h115.6c30.7 0 55.7-25 55.7-55.7v-115.6c0-30.7-25-55.7-55.7-55.7z" fill="#0ba23b"/><path d="m113.5 52.7-.5-.3-112 112v6.9c0 7.3 1.5 14.3 4.1 20.7l107.9-107.9.5.3 108.2 108.2c2.8-6.5 4.3-13.8 4.3-21.3v-6.1z" fill="#fcf411"/><path d="m171.3 1h-3l57.7 57.7v-3c0-30.2-24.5-54.7-54.7-54.7z" fill="#fcf411"/><path d="m57.8 1h-2.1c-30.2 0-54.7 24.5-54.7 54.7v2.1z" fill="#fcf411"/><path d="m226 94.5-93.5-93.5h-38.8l-92.7 92.7v31.7l112-112 .5.3 112.5 112.5z" fill="#fcf411"/><path d="m205.8 213.8-92.3-92.3-.5-.3-92.2002 92.2c6 5 13.1 8.7 20.9 10.8l71.3002-71.3.5.3 71.1 71.1c7.9-1.9 15.1-5.6 21.2-10.5z" fill="#fcf411"/><path d="m112.1 188.3 1 1 .8-.8z" fill="#fcf411"/><path d="m149.8 226-36.7-36.7-36.7001 36.7z" fill="#fcf411"/><path d="m166.5 213.1h-106.0001c-25.7 0-46.6-20.9-46.6-46.6v-106c0-25.7 20.9-46.6 46.6-46.6h106.0001c25.7 0 46.6 20.9 46.6 46.6v106c0 25.7-20.9 46.6-46.6 46.6z" fill="#0071b9"/><g fill="#fff"><path d="m56.2998 56.7v48.5h119.7002v-48.5zm26.9 43.7-8.2-27h-.1l-5.4 27h-9.8l8.3-39h13l8 27.1h.1l5.5-27.1h9.8002l-8.3002 39zm39.7002 0 3.5-16.7h-12.3l-3.5 16.7h-10.4l8.1-39h10.5l-3.1 14.9h12.3l3.1-14.9h10.5l-8.1 39zm46.1-30.2c-2.7-1.2-5.6-1.8-8.6-1.8-4.1 0-7.5.6-7.5 3.7 0 5.5 15.1 3.5 15.1 15.3 0 10.8-10 13.6-19.1 13.6-4.1-.1-8.2-.8-12.1-2l2.4-7.9c2.1 1.3 6.2 2.2 9.6 2.2s8.3-.6 8.3-4.6c0-6.3-15.1-3.9-15.1-14.9 0-10.1 8.8-13.1 17.4-13.1 4.8 0 9.3.5 12 1.7z"/><path d="m50.5001 156.8c-.6.4-1.6.6-3 .9-1.3.2-2.8.3-4.3.3-2.6 0-4.9-.4-6.8-1.3s-3.6-2.1-4.9-3.7-2.3-3.4-2.9-5.5c-.7-2.1-1-4.4-1-6.9s.3-4.8 1-6.9 1.6-4 2.9-5.5c1.3-1.6 2.9-2.8 4.8-3.7s4.2-1.3 6.7-1.3c1.7 0 3.3.2 4.6.5s2.3.6 2.9.9l-.3 5.6c-.6-.3-1.5-.7-2.5-1.2s-2.3-.7-3.9-.7c-1.3 0-2.5.2-3.7.7-1.1.5-2.2 1.2-3 2.2-.9 1-1.6 2.3-2.1 3.8-.5 1.6-.8 3.4-.8 5.6s.3 4.1.8 5.6c.5 1.6 1.2 2.8 2.1 3.8s1.9 1.7 3 2.2 2.4.7 3.7.7c1.5 0 2.8-.2 3.8-.5s1.9-.7 2.6-1.3z"/><path d="m52.6001 140.6c0-3 .4-5.7 1.1-7.9s1.7-4 3-5.4c1.2-1.4 2.7-2.5 4.3-3.1 1.6-.7 3.3-1 5.1-1s3.4.3 5.1 1c1.6.7 3.1 1.7 4.3 3.1s2.2 3.2 3 5.4c.7 2.2 1.1 4.8 1.1 7.9 0 3-.4 5.7-1.1 7.9s-1.7 4-3 5.4c-1.2 1.4-2.7 2.5-4.3 3.1-1.6.7-3.3 1-5.1 1s-3.4-.3-5.1-1c-1.6-.7-3.1-1.7-4.3-3.1s-2.2-3.2-3-5.4c-.7-2.3-1.1-4.9-1.1-7.9zm6.4 0c0 2.3.2 4.3.6 5.9s.9 2.9 1.5 3.9 1.4 1.7 2.3 2.2 1.8.7 2.8.7 1.9-.2 2.8-.7 1.6-1.2 2.3-2.2c.6-1 1.1-2.3 1.5-3.9s.6-3.6.6-5.9-.2-4.3-.6-5.9-.9-2.9-1.5-3.9-1.4-1.7-2.3-2.2-1.8-.7-2.8-.7-1.9.2-2.8.7-1.6 1.2-2.3 2.2c-.6 1-1.1 2.3-1.5 3.9s-.6 3.5-.6 5.9z"/><path d="m80.3003 123.6h6.7l6.8 26.1h.1l6.9997-26.1h6.4l-10.2997 33.9h-6.6z"/><path d="m110.4 123.6h6.2v33.9h-6.2z"/><path d="m122.6 123.6h8.8c5.3 0 9.4 1.4 12.1 4.2s4.1 7.1 4.1 12.7c0 2.8-.4 5.3-1.2 7.5-.8 2.1-1.9 3.9-3.4 5.3-1.4 1.4-3.1 2.5-5.1 3.2s-4.1 1-6.5 1h-8.8zm6.2 29.2h2.1c1.7 0 3.3-.3 4.5-.9 1.3-.6 2.3-1.4 3.2-2.5s1.4-2.4 1.8-3.9.6-3.2.6-5-.2-3.5-.6-5-1-2.8-1.8-3.9-1.9-1.9-3.2-2.5-2.8-.8-4.5-.8h-2.1z"/><path d="m152 141.2h11.2v5h-11.2z"/><path d="m170.7 130.8-4.5 4.2-2.9-4.2 8.3-7.2h5.1v33.9h-6z"/><path d="m183.8 151.8c.6.3 1.3.6 2.2.9.9.4 2 .5 3.4.5 1.7 0 3-.4 4-1.2s1.8-1.8 2.3-2.9.9-2.4 1.1-3.7.3-2.5.4-3.5l-.1-.1c-.6.9-1.4 1.7-2.3 2.4-1 .7-2.3 1-3.9 1-1.2 0-2.3-.2-3.4-.7s-2-1.1-2.9-2.1-1.5-2.1-2-3.4c-.5-1.4-.8-3-.8-4.8 0-1.7.2-3.2.7-4.6.4-1.4 1.1-2.5 1.9-3.5s1.9-1.7 3.1-2.2 2.7-.8 4.3-.8c2.2 0 4 .4 5.4 1.2s2.5 2 3.4 3.4c.8 1.4 1.4 3.1 1.8 5.1.3 1.9.5 4 .5 6.1 0 2.5-.2 4.9-.6 7.2s-1.1 4.3-2.1 6.1c-1 1.7-2.3 3.1-4 4.2s-3.8 1.6-6.4 1.6c-1.6 0-2.8-.1-3.9-.4-1-.3-1.8-.5-2.4-.8zm4.1-17.7c0 1.8.3 3.4 1 4.6s1.8 1.8 3.4 1.8c1.5 0 2.5-.6 3.3-1.7.7-1.1 1.1-2.7 1.1-4.6 0-2-.3-3.6-1-4.7s-1.8-1.7-3.3-1.7c-1.6 0-2.7.6-3.4 1.7-.7 1-1.1 2.6-1.1 4.6z"/></g></svg>
|
Binary file
|
@@ -1,9 +0,0 @@
|
|
1
|
-
<svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
-
<circle cx="19.5" cy="19.5" r="19.5" fill="#366FB3" mask="url(#mask)"/>
|
3
|
-
|
4
|
-
<mask id="mask">
|
5
|
-
<rect width="100%" height="100%" fill="white"/>
|
6
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.0343 20L14.1812 10.1469L17.0096 7.31848L29.6912 20L17.0096 32.6815L14.1812 29.8531L24.0343 20Z" fill="black"/>
|
7
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M0.000423781 18L25.1328 18L25.1328 22L0.000423431 22L0.000423781 18Z" fill="black"/>
|
8
|
-
</mask>
|
9
|
-
</svg>
|
@@ -1,3 +0,0 @@
|
|
1
|
-
<svg width="38" height="36" viewBox="0 0 38 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
-
<path d="M38 35.8461C34.8518 35.8299 31.701 35.8136 28.5528 35.7974C28.5447 29.2599 28.5366 22.7252 28.5284 16.1878C21.8989 22.7252 15.2721 29.2599 8.64252 35.7974C5.8547 35.792 3.06417 35.7838 0.276344 35.7784C0.262798 34.1366 0.249251 32.4948 0.232996 30.8503C7.36917 23.7195 14.5026 16.5833 21.6388 9.44717C14.4268 9.47697 7.21204 9.50406 0 9.53387C3.17254 6.35862 6.34778 3.18608 9.52032 0.010837C19.0135 0.00812776 28.5068 0.00270925 38 0C38 11.9234 38 23.8577 38 35.8461Z" fill="#FF003B"/>
|
3
|
-
</svg>
|
@@ -1 +0,0 @@
|
|
1
|
-
<svg width="39" height="39" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M17.01 6.818l-2.828 2.828 7.853 7.854-22 .066L0 21.5h22.035l-7.853 7.854 2.828 2.828L29.69 19.5zM39 19.5C39 30.27 30.27 39 19.5 39 9.373 39 1.05 31.28.092 21.405A19.737 19.737 0 010 19.5C0 8.73 8.73 0 19.5 0S39 8.73 39 19.5z" fill="#fff500"/></svg>
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
<svg width="39" height="39" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M17.01 6.818l-2.828 2.828 7.853 7.854-22 .066L0 21.5h22.035l-7.853 7.854 2.828 2.828L29.69 19.5zM39 19.5C39 30.27 30.27 39 19.5 39 9.373 39 1.05 31.28.092 21.405A19.737 19.737 0 010 19.5C0 8.73 8.73 0 19.5 0S39 8.73 39 19.5z" fill="#fff"/></svg>
|