Skip to content

Commit

Permalink
fix tracking
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
joelanman committed Jul 10, 2018
1 parent 6b58401 commit ec72c28
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/views/layout.html
Expand Up @@ -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 %}
Expand Down
2 changes: 1 addition & 1 deletion server.js
Expand Up @@ -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()
})

Expand Down

0 comments on commit ec72c28

Please sign in to comment.