hof 20.3.7-beta-gtm → 20.3.7
Sign up to get free protection for your applications and to get access to all the features.
- package/config/hof-defaults.js +8 -1
- package/frontend/govuk-template/build/govuk_template.html +3 -4
- package/frontend/template-partials/views/partials/head.html +3 -6
- package/lib/ga-tag.js +6 -11
- package/package.json +2 -2
- package/.nyc_output/c84e394d-abf7-4aea-99aa-36427e671442.json +0 -1
- package/.nyc_output/processinfo/c84e394d-abf7-4aea-99aa-36427e671442.json +0 -1
- package/.nyc_output/processinfo/index.json +0 -1
- package/frontend/govuk-template/govuk_template_generated.html +0 -103
- package/sandbox/apps/sandbox/translations/en/default.json +0 -220
- package/sandbox/public/css/app.css +0 -9387
- package/sandbox/public/images/icons/icon-caret-left.png +0 -0
- package/sandbox/public/images/icons/icon-complete.png +0 -0
- package/sandbox/public/images/icons/icon-cross-remove-sign.png +0 -0
- package/sandbox/public/js/bundle.js +0 -35664
package/config/hof-defaults.js
CHANGED
@@ -22,7 +22,14 @@ const defaults = {
|
|
22
22
|
env: process.env.NODE_ENV || 'development',
|
23
23
|
gaTagId: process.env.GA_TAG || 'Test-GA-Tag',
|
24
24
|
ga4TagId: process.env.GA_4_TAG,
|
25
|
-
|
25
|
+
// added to allow support for multiple HOF forms using GTM to customize how they track page views
|
26
|
+
gtm: {
|
27
|
+
tagId: process.env.GTM_TAG || false,
|
28
|
+
config: {},
|
29
|
+
composePageName: function (page, convertPage) {
|
30
|
+
return convertPage(page);
|
31
|
+
}
|
32
|
+
},
|
26
33
|
gaCrossDomainTrackingTagId: process.env.GDS_CROSS_DOMAIN_GA_TAG,
|
27
34
|
loglevel: process.env.LOG_LEVEL || 'info',
|
28
35
|
ignoreMiddlewareLogs: ['/healthz'],
|
@@ -41,13 +41,12 @@
|
|
41
41
|
<a href="{{{ homepageUrl }}}" title="{{ logoLinkTitle }}" id="logo" class="govuk-header__link govuk-header__link--homepage" target="_blank" data-module="track-click" data-track-category="homeLinkClicked" data-track-action="homeHeader">
|
42
42
|
<span class="govuk-header__logotype">
|
43
43
|
<!--[if gt IE 8]><!-->
|
44
|
-
<svg aria-hidden="true" focusable="false" class="govuk-header__logotype-crown" xmlns="http://www.w3.org/2000/svg" viewBox="0 0
|
45
|
-
<path fill="currentColor" fill-rule="evenodd"
|
44
|
+
<svg aria-hidden="true" focusable="false" class="govuk-header__logotype-crown" xmlns="http://www.w3.org/2000/svg\" viewBox="0 0 32 30" height="30" width="32">
|
45
|
+
<path fill="currentColor" fill-rule="evenodd" d="M22.6 10.4c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4m-5.9 6.7c-.9.4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4m10.8-3.7c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s0 2-1 2.4m3.3 4.8c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4M17 4.7l2.3 1.2V2.5l-2.3.7-.2-.2.9-3h-3.4l.9 3-.2.2c-.1.1-2.3-.7-2.3-.7v3.4L15 4.7c.1.1.1.2.2.2l-1.3 4c-.1.2-.1.4-.1.6 0 1.1.8 2 1.9 2.2h.7c1-.2 1.9-1.1 1.9-2.1 0-.2 0-.4-.1-.6l-1.3-4c-.1-.2 0-.2.1-.3m-7.6 5.7c.9.4 2-.1 2.4-1 .4-.9-.1-2-1-2.4-.9-.4-2 .1-2.4 1s0 2 1 2.4m-5 3c.9.4 2-.1 2.4-1 .4-.9-.1-2-1-2.4-.9-.4-2 .1-2.4 1s.1 2 1 2.4m-3.2 4.8c.9.4 2-.1 2.4-1 .4-.9-.1-2-1-2.4-.9-.4-2 .1-2.4 1s0 2 1 2.4m14.8 11c4.4 0 8.6.3 12.3.8 1.1-4.5 2.4-7 3.7-8.8l-2.5-.9c.2 1.3.3 1.9 0 2.7-.4-.4-.8-1.1-1.1-2.3l-1.2 4c.7-.5 1.3-.8 2-.9-1.1 2.5-2.6 3.1-3.5 3-1.1-.2-1.7-1.2-1.5-2.1.3-1.2 1.5-1.5 2.1-.1 1.1-2.3-.8-3-2-2.3 1.9-1.9 2.1-3.5.6-5.6-2.1 1.6-2.1 3.2-1.2 5.5-1.2-1.4-3.2-.6-2.5 1.6.9-1.4 2.1-.5 1.9.8-.2 1.1-1.7 2.1-3.5 1.9-2.7-.2-2.9-2.1-2.9-3.6.7-.1 1.9.5 2.9 1.9l.4-4.3c-1.1 1.1-2.1 1.4-3.2 1.4.4-1.2 2.1-3 2.1-3h-5.4s1.7 1.9 2.1 3c-1.1 0-2.1-.2-3.2-1.4l.4 4.3c1-1.4 2.2-2 2.9-1.9-.1 1.5-.2 3.4-2.9 3.6-1.9.2-3.4-.8-3.5-1.9-.2-1.3 1-2.2 1.9-.8.7-2.3-1.2-3-2.5-1.6.9-2.2.9-3.9-1.2-5.5-1.5 2-1.3 3.7.6 5.6-1.2-.7-3.1 0-2 2.3.6-1.4 1.8-1.1 2.1.1.2.9-.3 1.9-1.5 2.1-.9.2-2.4-.5-3.5-3 .6 0 1.2.3 2 .9l-1.2-4c-.3 1.1-.7 1.9-1.1 2.3-.3-.8-.2-1.4 0-2.7l-2.9.9C1.3 23 2.6 25.5 3.7 30c3.7-.5 7.9-.8 12.3-.8\"></path>
|
46
46
|
</svg>
|
47
47
|
<!--<![endif]-->
|
48
|
-
<!--<![endif]-->
|
49
48
|
<!--[if IE 8]>
|
50
|
-
<img src="{{ assetPath }}images/govuk-logotype-crown.png" class="govuk-header__logotype-crown-fallback-image" width="
|
49
|
+
<img src="{{ assetPath }}images/govuk-logotype-tudor-crown.png" class="govuk-header__logotype-crown-fallback-image" width="32" height="30" alt="">
|
51
50
|
<![endif]-->
|
52
51
|
</span>
|
53
52
|
<span class="govuk-header__logotype-text">
|
@@ -3,12 +3,9 @@
|
|
3
3
|
<!-- Google Tag Manager Data Layer -->
|
4
4
|
<script {{#nonce}}nonce="{{nonce}}"{{/nonce}}>
|
5
5
|
var dataLayer = window.dataLayer || [];
|
6
|
-
dataLayer.push(
|
7
|
-
|
8
|
-
|
9
|
-
'applicationType': '{{applicationType}}',
|
10
|
-
'environmentType': '{{environmentType}}'
|
11
|
-
});
|
6
|
+
dataLayer.push(
|
7
|
+
{{{gtmConfig}}}
|
8
|
+
);
|
12
9
|
</script>
|
13
10
|
<!-- End Google Tag Manager Data Layer -->
|
14
11
|
|
package/lib/ga-tag.js
CHANGED
@@ -52,12 +52,11 @@ const setupPageMap = routes => {
|
|
52
52
|
module.exports = (app, config) => {
|
53
53
|
const gaTagId = config.gaTagId;
|
54
54
|
const ga4TagId = config.ga4TagId;
|
55
|
-
const
|
56
|
-
const environmentType = config.environmentType ? config.environmentType : 'dev';
|
55
|
+
const gtm = config.gtm;
|
57
56
|
const gaCrossDomainTrackingTagId = config.gaCrossDomainTrackingTagId;
|
58
57
|
const routes = config.routes;
|
59
58
|
|
60
|
-
if (gaTagId || ga4TagId ||
|
59
|
+
if (gaTagId || ga4TagId || gtm.tagId) {
|
61
60
|
const pageMap = setupPageMap(routes);
|
62
61
|
|
63
62
|
app.use((req, res, next) => {
|
@@ -74,17 +73,13 @@ module.exports = (app, config) => {
|
|
74
73
|
};
|
75
74
|
|
76
75
|
// Adding extra properties if a GTM TAG is available
|
77
|
-
if (
|
76
|
+
if (gtm.tagId) {
|
77
|
+
gtm.config.pageName = gtm.composePageName(page, convertToGTMPage);
|
78
78
|
Object.assign(properties, {
|
79
|
-
|
80
|
-
|
81
|
-
pageEvent: 'pageLoad',
|
82
|
-
pageName: `ETA | Customer Contact Webform | ${convertToGTMPage(page)}`,
|
83
|
-
applicationType: 'ETA | Customer Contact',
|
84
|
-
environmentType: environmentType
|
79
|
+
gtmConfig: JSON.stringify(gtm.config),
|
80
|
+
gtmTagId: gtm.tagId
|
85
81
|
});
|
86
82
|
}
|
87
|
-
|
88
83
|
res.locals = Object.assign(res.locals, properties);
|
89
84
|
next();
|
90
85
|
});
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "hof",
|
3
3
|
"description": "A bootstrap for HOF projects",
|
4
|
-
"version": "20.3.7
|
4
|
+
"version": "20.3.7",
|
5
5
|
"license": "MIT",
|
6
6
|
"main": "index.js",
|
7
7
|
"author": "HomeOffice",
|
@@ -57,7 +57,7 @@
|
|
57
57
|
"findup": "^0.1.5",
|
58
58
|
"glob": "^7.2.0",
|
59
59
|
"govuk-elements-sass": "^3.1.3",
|
60
|
-
"govuk-frontend": "3.
|
60
|
+
"govuk-frontend": "3.15",
|
61
61
|
"govuk_template_mustache": "^0.26.0",
|
62
62
|
"helmet": "^3.22.0",
|
63
63
|
"hogan-express-strict": "^0.5.4",
|