Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added google analytics script #256

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ module.exports = function(eleventyConfig) {
eleventyConfig.addPassthroughCopy({"lib/_netlify": "/"});
eleventyConfig.addPassthroughCopy({"node_modules/nhsuk-frontend/packages/assets": "/nhsuk-frontend/assets"});
eleventyConfig.addPassthroughCopy({"node_modules/nhsuk-frontend/dist/*.js": "/javascripts"});
eleventyConfig.addPassthroughCopy({"node_modules/@nhsbsa/cookie-consent-component/dist/*.js": "/javascripts"});
nhsbsa-Will marked this conversation as resolved.
Show resolved Hide resolved
eleventyConfig.addPassthroughCopy("src/**/*.jpg");
eleventyConfig.addPassthroughCopy("src/**/*.jpeg");
eleventyConfig.addPassthroughCopy("src/**/*.png");
Expand Down
4 changes: 2 additions & 2 deletions lib/_components/appFooter/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="nhsuk-footer
{%- if params.classes %} {{ params.classes }}{% endif %}" id="nhsuk-footer"
{%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
<div class="nhsuk-width-container">
<div class="nhsuk-width-container {{ footerContainerClasses | default('app-width-container') }}">
nhsbsa-Will marked this conversation as resolved.
Show resolved Hide resolved
{%- if params.links %}
<h2 class="nhsuk-u-visually-hidden">Support links</h2>

Expand All @@ -18,7 +18,7 @@
</div>

<div class="nhsuk-ogl-footer">
<div class="nhsuk-width-container">
<div class="nhsuk-width-container {{ oglContainerClasses | default('app-width-container') }}">
nhsbsa-Will marked this conversation as resolved.
Show resolved Hide resolved
<p class="nhsuk-ogl-footer--text">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 483.2 195.7" height="17" width="41" focusable="false">
<path fill="currentColor" d="M421.5 142.8V.1l-50.7 32.3v161.1h112.4v-50.7zm-122.3-9.6A47.12 47.12 0 0 1 221 97.8c0-26 21.1-47.1 47.1-47.1 16.7 0 31.4 8.7 39.7 21.8l42.7-27.2A97.63 97.63 0 0 0 268.1 0c-36.5 0-68.3 20.1-85.1 49.7A98 98 0 0 0 97.8 0C43.9 0 0 43.9 0 97.8s43.9 97.8 97.8 97.8c36.5 0 68.3-20.1 85.1-49.7a97.76 97.76 0 0 0 149.6 25.4l19.4 22.2h3v-87.8h-80l24.3 27.5zM97.8 145c-26 0-47.1-21.1-47.1-47.1s21.1-47.1 47.1-47.1 47.2 21 47.2 47S123.8 145 97.8 145"></path>
Expand Down
208 changes: 122 additions & 86 deletions lib/_layouts/_base.njk
Original file line number Diff line number Diff line change
Expand Up @@ -3,88 +3,123 @@
{% from "hero/macro.njk" import hero as appHero %}
{% from "appFooter/macro.njk" import appFooter as oglFooter %}
{% from 'back-link/macro.njk' import backLink %}
{% from 'cookie-banner/macro.njk' import cookieBanner %}
{% set htmlClasses = 'no-js' %}
{% set homeUrl = '/' | url %}
{% set containerClasses = containerClasses | default("app-width-container") %}
<html lang="{{ htmlLang | default('en') }}">

{% block head %}
<head>
{% block headStart %}
{% block head %}
<head>
{% block headStart %}{% endblock %}
nhsbsa-Will marked this conversation as resolved.
Show resolved Hide resolved

{% block headMeta %}
nhsbsa-Will marked this conversation as resolved.
Show resolved Hide resolved
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="{{ description | markdown("inline") | striptags(true) }}">
<meta name="robots" content="{{ robots | default('noindex') }}">
{% endblock %}

{% block pageTitle %}
nhsbsa-Will marked this conversation as resolved.
Show resolved Hide resolved
<title>
{% if title %}{{ title }} - {% endif %}{{ serviceName or productLongName or siteMeta.productLongName }} - {{ siteMeta.organisation }}
</title>
{% endblock %}

{% block googleAnalytics %}
<!-- Google tag (gtag.js) -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=G-NQ562NM01Z" type="text/plain" data-cookieconsent="statistics"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-NQ562NM01Z');
</script>
{% endblock %}

<!-- New NHSUK asset and font -->
<link href="https://assets.nhs.uk/" rel="preconnect" crossorigin>
<link type="font/woff2" href="https://assets.nhs.uk/fonts/FrutigerLTW01-55Roman.woff2" rel="preload" as="font" crossorigin>
<link type="font/woff2" href="https://assets.nhs.uk/fonts/FrutigerLTW01-65Bold.woff2" rel="preload" as="font" crossorigin>

{% block headIcons %}
<!-- NHS Icons -->
<link rel="shortcut icon" href="{{ '/nhsuk-frontend/assets/favicons/favicon.ico' | url }}" type="image/x-icon">
<link rel="apple-touch-icon" href="{{ '/nhsuk-frontend/assets/favicons/apple-touch-icon-180x180.png' | url }}">
<link rel="mask-icon" href="{{ '/nhsuk-frontend/assets/favicons/favicon.svg' | url }}" color="#005eb8">
<link rel="icon" sizes="192x192" href="{{ '/nhsuk-frontend/assets/favicons/favicon-192x192.png' | url }}">
{% endblock %}

{% block msApplicationTiles %}
<meta name="msapplication-TileImage" content="{{ '/nhsuk-frontend/assets/favicons/mediumtile-144x144.png' | url }}">
<meta name="msapplication-TileColor" content="#005eb8">
<meta name="msapplication-square70x70logo" content="{{ '/nhsuk-frontend/assets/favicons/smalltile-70x70.png' | url }}">
<meta name="msapplication-square150x150logo" content="{{ '/nhsuk-frontend/assets/favicons/mediumtile-150x150.png' | url }}">
<meta name="msapplication-wide310x150logo" content="{{ '/nhsuk-frontend/assets/favicons/widetile-310x150.png' | url }}">
<meta name="msapplication-square310x310logo" content="{{ '/nhsuk-frontend/assets/favicons/largetile-310x310.png' | url }}">
{% endblock %}

{% block openGraph %}
<meta property="og:url" content="{{ page.url | url | absoluteUrl }}"/>
<meta property="og:site_name" content="nhsbsa.nhs.uk"/>
{% if description %}
<meta property="og:description" content="{{ description | markdown("inline") | striptags(true) }}">
{% endif %}
<meta property="og:type" content="website"/>
<meta property="og:locale" content="en_GB"/>
<meta property="og:image" content="{{ '/images/opengraph-image.png' | url | absoluteUrl }}">
<meta property="og:title" content="{% if title %}{{ title }} - {% endif %}{{ serviceName or productLongName or siteMeta.productLongName }} - {{ siteMeta.organisation }}">
{% endblock %}

{% block stylesheets %}
<link href="{{ '/stylesheets/application.css' | url }}" media="all" rel="stylesheet" type="text/css"/>
{% endblock %}

{% block headEnd %}{% endblock %}
</head>
{% endblock %}

{% block headMeta %}
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="{{ description | markdown("inline") | striptags(true) }}">
<meta name="robots" content="{{ robots | default('noindex') }}">
{% endblock %}

{% block pageTitle %}
<title>
{% if title %}{{ title }} - {% endif %}{{ serviceName or productLongName or siteMeta.productLongName }} - {{ siteMeta.organisation }}
</title>
{% endblock %}

<!-- New NHSUK asset and font -->
<link href="https://assets.nhs.uk/" rel="preconnect" crossorigin>
<link type="font/woff2" href="https://assets.nhs.uk/fonts/FrutigerLTW01-55Roman.woff2" rel="preload" as="font" crossorigin>
<link type="font/woff2" href="https://assets.nhs.uk/fonts/FrutigerLTW01-65Bold.woff2" rel="preload" as="font" crossorigin>

{% block headIcons %}
<!-- NHS Icons -->
<link rel="shortcut icon" href="{{ '/nhsuk-frontend/assets/favicons/favicon.ico' | url }}" type="image/x-icon">
<link rel="apple-touch-icon" href="{{ '/nhsuk-frontend/assets/favicons/apple-touch-icon-180x180.png' | url }}">
<link rel="mask-icon" href="{{ '/nhsuk-frontend/assets/favicons/favicon.svg' | url }}" color="#005eb8">
<link rel="icon" sizes="192x192" href="{{ '/nhsuk-frontend/assets/favicons/favicon-192x192.png' | url }}">
{% endblock %}

{% block msApplicationTiles %}
<meta name="msapplication-TileImage" content="{{ '/nhsuk-frontend/assets/favicons/mediumtile-144x144.png' | url }}">
<meta name="msapplication-TileColor" content="#005eb8">
<meta name="msapplication-square70x70logo" content="{{ '/nhsuk-frontend/assets/favicons/smalltile-70x70.png' | url }}">
<meta name="msapplication-square150x150logo" content="{{ '/nhsuk-frontend/assets/favicons/mediumtile-150x150.png' | url }}">
<meta name="msapplication-wide310x150logo" content="{{ '/nhsuk-frontend/assets/favicons/widetile-310x150.png' | url }}">
<meta name="msapplication-square310x310logo" content="{{ '/nhsuk-frontend/assets/favicons/largetile-310x310.png' | url }}">
{% endblock %}

{% block openGraph %}
<meta property="og:url" content="{{ page.url | url | absoluteUrl }}"/>
<meta property="og:site_name" content="nhsbsa.nhs.uk"/>
{% if description %}
<meta property="og:description" content="{{ description | markdown("inline") | striptags(true) }}">
{% endif %}
<meta property="og:type" content="website"/>
<meta property="og:locale" content="en_GB"/>
<meta property="og:image" content="{{ '/images/opengraph-image.png' | url | absoluteUrl }}">
<meta property="og:title" content="{% if title %}{{ title }} - {% endif %}{{ serviceName or productLongName or siteMeta.productLongName }} - {{ siteMeta.organisation }}">
{% endblock %}

{% block stylesheets %}
<link href="{{ '/stylesheets/application.css' | url }}" media="all" rel="stylesheet" type="text/css" />
{% endblock %}

{% block headEnd %}
{% endblock %}
</head>
{% endblock %}

<body class="{{ bodyClasses }}" {%- for attribute, value in bodyAttributes %} {{attribute}}="{{value}}"{% endfor %}>

<script>document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');</script>

{% block bodyStart %}{% endblock %}

{% block skipLink %}
{{ skipLink({
<body class="{{ bodyClasses }}" {%- for attribute, value in bodyAttributes %} {{attribute}}="{{value}}"{% endfor %}>

<script>
document.body.className = (
(document.body.className)
nhsbsa-Will marked this conversation as resolved.
Show resolved Hide resolved
? document.body.className + ' js-enabled'
: 'js-enabled');
</script>

{% block cookieBanner %}
{{ cookieBanner({
policyUrl: "/cookie-policy/" | url,
classes: "app-width-container",
linkText: "read more about our cookies",
cookieBannerHeading: "NHSBSA Digital, Data and Technology Playbook",
cookieBannerContent: [
"We've put some small files called cookies on your device to make our site work.",
"We'd also like to use analytics cookies. These send anonymous information about how our site is used to a service called Google Analytics. We use this information to improve our site.",
"Let us know if this is OK. We'll use a cookie to save your choice across all our digital services for the next 3 calendar months. You can {{cookiePolicyHref}} before you choose."
],
okButtonText: "I'm OK with analytics cookies",
notOkButtonText: "Do not use analytics cookies",
cookieVersion: 1,
successLinkText: "our cookies page",
successBannerMessage: "You can change your cookie settings at any time using {{bannerSuccessHref}}."
}) }}
{% endblock %}

{% block bodyStart %}{% endblock %}

{% block skipLink %}
{{ skipLink({
aircwo marked this conversation as resolved.
Show resolved Hide resolved
href: '#main-content',
text: 'Skip to main content'
}) }}
{% endblock %}
{% endblock %}

{% block header %}
{{ header({
{% block header %}
{{ header({
"homeHref": homeUrl,
"ariaLabel": siteMeta.header.description,
"organisation": {
Expand All @@ -93,22 +128,23 @@
}
})
}}
{% endblock %}
{% endblock %}

{% block main %}{% endblock %}
{% block main %}{% endblock %}

{% block footer %}
{{ oglFooter({
{% block footer %}
{{ oglFooter({
"links": siteMeta.footer.links
})}}
{% endblock %}

{% block bodyEndScripts %}
<script src="{{ '/javascripts/nhsuk.min.js' | url }}"></script>
<script src="{{ '/javascripts/application.js' | url }}"></script>
{% block pageScripts %}{% endblock %}
{% endblock %}

{% block bodyEnd %}{% endblock %}
</body>
</html>
{% endblock %}

{% block bodyEndScripts %}
<script src="{{ '/javascripts/nhsuk.min.js' | url }}"></script>
<script src="{{ '/javascripts/application.js' | url }}"></script>
<script src="{{ '/javascripts/cookie-banner.js' | url }}"></script>
{% block pageScripts %}{% endblock %}
{% endblock %}

{% block bodyEnd %}{% endblock %}
</body>
</html>
2 changes: 1 addition & 1 deletion lib/_layouts/_page.njk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{% from "prose/macro.njk" import appProse %}

{% block main %}
<div class="nhsuk-width-container">
<div class="nhsuk-width-container {{ containerClasses }}">
{% block beforeContent %}{% endblock %}
<main class="nhsuk-main-wrapper {{ mainClasses }}" id="main-content" role="main"{% if mainLang %} lang="{{ mainLang }}"{% endif %}>
<div class="nhsuk-grid-row">
Expand Down
1 change: 1 addition & 0 deletions lib/_libraries/nunjucks.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports = (() => {
'lib/_layouts',
'lib/_components',
'node_modules/nhsuk-frontend/packages/components',
'node_modules/@nhsbsa/cookie-consent-component/component',
],
{
watch: process.env.NODE_ENV === 'development',
Expand Down
14 changes: 14 additions & 0 deletions lib/_stylesheets/app/_cookie-banner.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* ==========================================================================
#COOKIE BANNER
========================================================================== */

// Container width variable
$cookie-app-container-size: 1100px;
nhsbsa-Will marked this conversation as resolved.
Show resolved Hide resolved

#nhsuk-cookie-banner .app-width-container {
max-width: $cookie-app-container-size;

@media (min-width: 767px) and (max-width: 1164px) {
margin: 0 nhsuk-spacing(5);
}
}
1 change: 1 addition & 0 deletions lib/_stylesheets/app/_imports.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
@import 'colour-swatch';
@import 'contact-panel';
@import 'container';
@import 'cookie-banner';
@import 'example-callout';
@import 'featured-list';
@import 'footer';
Expand Down
1 change: 1 addition & 0 deletions lib/_stylesheets/application.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import "node_modules/nhsuk-frontend/packages/nhsuk";
@import "node_modules/@nhsbsa/cookie-consent-component/dist/cookie-banner";
@import './app/imports';
@import './custom/imports';
Loading