From ec72c28ab7b48db9b8b9f5e86603457d41b592a9 Mon Sep 17 00:00:00 2001 From: Joe Lanman Date: Tue, 10 Jul 2018 14:09:45 +0100 Subject: [PATCH] fix tracking - change app.locals to res.locals because Do not track is a per-request setting - change false to False because Nunjucks uses Python-style syntax and doesn't understand false --- docs/views/layout.html | 4 ++-- server.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/views/layout.html b/docs/views/layout.html index dcc104ae65..b8f5d571d2 100644 --- a/docs/views/layout.html +++ b/docs/views/layout.html @@ -24,14 +24,14 @@ {% block head %} {% include "includes/head.html" %} - {% if doNotTrackEnabled == false and promoMode == 'true' and gtmId %} + {% if doNotTrackEnabled == False and promoMode == 'true' and gtmId %} {% include "includes/tracking_head.html" %} {% endif %} {% endblock %} {% block bodyStart %} - {% if doNotTrackEnabled == false and promoMode == 'true' and gtmId %} + {% if doNotTrackEnabled == False and promoMode == 'true' and gtmId %} {% include "includes/tracking_body.html" %} {% endif %} {% endblock %} diff --git a/server.js b/server.js index a33a7a686e..0dd22d3c22 100644 --- a/server.js +++ b/server.js @@ -128,7 +128,7 @@ app.use(bodyParser.urlencoded({ // Therefore we can avoid injecting third-party scripts that do not respect this decision. app.use(function (req, res, next) { // See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/DNT - app.locals.doNotTrackEnabled = (req.header('DNT') === '1') + res.locals.doNotTrackEnabled = (req.header('DNT') === '1') next() })