fix path parsing to not include hostname when using https. closes #22

This commit is contained in:
Danny van Kooten 2018-05-03 08:40:15 +02:00
parent c47fc3d893
commit 956dd539c8
1 changed files with 7 additions and 2 deletions

View File

@ -59,9 +59,13 @@ function trackPageview() {
// get the path or canonical
var path = location.pathname + location.search;
// parse path from canonical, if page has one
var canonical = document.querySelector('link[rel="canonical"][href]');
if(canonical) {
path = canonical.href.substring(canonical.href.indexOf('/', 7)) || '/';
var a = document.createElement('a');
a.href = canonical.href;
path = a.pathname;
}
var d = {
@ -73,7 +77,8 @@ function trackPageview() {
sr: screen.width + "x" + screen.height,
t: document.title,
ru: document.referrer,
rk: ""
rk: "",
scheme: location.protocol.substring(0, location.protocol.length - 1),
};
var i = document.createElement('img');