From 8f7c6d2e45ebb28651208e2a7320e29948ecdb2c Mon Sep 17 00:00:00 2001 From: Danny van Kooten Date: Fri, 30 Nov 2018 10:19:36 +0100 Subject: [PATCH] don't track request if page is served from local filesystem (instead of over http). closes #190 --- assets/src/js/tracker.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/assets/src/js/tracker.js b/assets/src/js/tracker.js index 206e2954..80605df1 100644 --- a/assets/src/js/tracker.js +++ b/assets/src/js/tracker.js @@ -128,6 +128,13 @@ // parse request, use canonical if there is one let req = window.location; + + // do not track if not served over HTTP or HTTPS (eg from local filesystem) + if(req.host === '') { + return; + } + + // find canonical URL let canonical = document.querySelector('link[rel="canonical"][href]'); if(canonical) { let a = document.createElement('a');