Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
Merge 2de64e4 into 341d871
Browse files Browse the repository at this point in the history
  • Loading branch information
st3v3nhunt committed Mar 15, 2019
2 parents 341d871 + 2de64e4 commit 0746cd6
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ environment.
| :--------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------ | :--------- |
| `ADOBE_TRACKING_URL` | [Adobe Analytics](https://www.adobe.com/analytics/adobe-analytics.html) Dynamic Tag Management URL | | No |
| `BASIC_AUTH` | An MD5 encrypted [htpasswd](https://httpd.apache.org/docs/2.4/misc/password_encryptions.html) | test:test | No |
| `COOKIEBOT_SCRIPT_URL` | The URL for the in-house implementation of Cookiebot | //assets.nhs.uk/scripts/cookie-consent.js | |
| `HOTJAR_ANALYTICS_TRACKING_ID` | [Hotjar](https://www.hotjar.com/) tracking id | | No |
| `GOOGLE_ANALYTICS_TRACKING_ID` | [Google Analytics](https://www.google.co.uk/analytics) property id | | No |
| `LOG_LEVEL` | Numeric [log level](https://github.com/trentm/node-bunyan#levels) | Depends on `NODE_ENV` | No |
Expand Down
2 changes: 2 additions & 0 deletions app/middleware/locals.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ module.exports = config => (req, res, next) => {
res.locals.GOOGLE_ANALYTICS_TRACKING_ID = config.analytics.googleAnalyticsId;
res.locals.HOTJAR_ANALYTICS_TRACKING_ID = config.analytics.hotjarId;

res.locals.COOKIEBOT_SCRIPT_URL = config.cookiebot.scriptUrl;

res.locals.assetsUrl = req.app.locals.assetsUrl;
res.locals.siteRoot = req.app.locals.siteRoot;
res.locals.digitalData = digitalData(req);
Expand Down
2 changes: 1 addition & 1 deletion app/views/includes/analytics.nunjucks
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% if GOOGLE_ANALYTICS_TRACKING_ID %}
<script>
<script type="text/plain" data-cookieconsent="marketing,statistics">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
Expand Down
2 changes: 2 additions & 0 deletions app/views/includes/foot.nunjucks
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
<!--<![endif]-->
<script src="{{ siteRoot }}/js/vendor/typeahead.bundle-1.2.1.min.js"></script>
<script src="{{ siteRoot }}/js/app.js"></script>

{% include 'includes/analytics.nunjucks' %}
6 changes: 4 additions & 2 deletions app/views/layout.nunjucks
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@

<!--[if lt IE 9]><script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script><![endif]-->

<script src="{{ COOKIEBOT_SCRIPT_URL }}" type="text/javascript" data-cookieconsent="necessary" async></script>

{% if HOTJAR_ANALYTICS_TRACKING_ID %}
<!-- rational for this code being in head: https://docs.hotjar.com/v1.0/docs/manual -->
<script>
<script type="text/plain" data-cookieconsent="statistics">
(function(h,o,t,j,a,r){
h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
h._hjSettings={hjid:{{ HOTJAR_ANALYTICS_TRACKING_ID }},hjsv:5};
Expand All @@ -44,7 +46,7 @@
{% block meta %}{% endblock %}

{% if ADOBE_TRACKING_URL %}
<script src="{{ ADOBE_TRACKING_URL }}" async></script>
<script type="text/plain" data-cookieconsent="statistics" src="{{ ADOBE_TRACKING_URL }}" async></script>
{% endif %}

{% include "includes/digitalData.nunjucks" %}
Expand Down
3 changes: 3 additions & 0 deletions config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ module.exports = {
port: process.env.PORT || 3000,
root: rootPath,
},
cookiebot: {
scriptUrl: process.env.COOKIEBOT_SCRIPT_URL || '//assets.nhs.uk/scripts/cookie-consent.js',
},
search: {
apiKey: process.env.SEARCH_API_KEY,
host: process.env.SEARCH_API_HOST || 'api.nhs.uk',
Expand Down
1 change: 1 addition & 0 deletions rancher-config/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
image: "nhsuk/sexual-health-service-finder:${DOCKER_IMAGE_TAG}"
environment:
ADOBE_TRACKING_URL: ${ADOBE_TRACKING_URL}
COOKIEBOT_SCRIPT_URL: ${COOKIEBOT_SCRIPT_URL}
GOOGLE_ANALYTICS_TRACKING_ID: ${GOOGLE_ANALYTICS_TRACKING_ID}
HOTJAR_ANALYTICS_TRACKING_ID: ${HOTJAR_ANALYTICS_TRACKING_ID}
NODE_ENV: production
Expand Down

0 comments on commit 0746cd6

Please sign in to comment.