mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-08 10:29:04 +01:00
Merge pull request #2679 from CediGasser/fix/track-only-path-on-pushstate
Fix: Properly parse url and respect data-exclude-search attribute in tracker
This commit is contained in:
commit
a83a71a612
@ -7,7 +7,7 @@
|
|||||||
document,
|
document,
|
||||||
history,
|
history,
|
||||||
} = window;
|
} = window;
|
||||||
const { hostname, pathname, search } = location;
|
const { hostname, href } = location;
|
||||||
const { currentScript, referrer } = document;
|
const { currentScript, referrer } = document;
|
||||||
|
|
||||||
if (!currentScript) return;
|
if (!currentScript) return;
|
||||||
@ -52,6 +52,12 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const parseURL = url => {
|
const parseURL = url => {
|
||||||
|
try {
|
||||||
|
const { pathname, search } = new URL(url);
|
||||||
|
url = pathname + search;
|
||||||
|
} catch {
|
||||||
|
/* empty */
|
||||||
|
}
|
||||||
return excludeSearch ? url.split('?')[0] : url;
|
return excludeSearch ? url.split('?')[0] : url;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -238,7 +244,7 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
let currentUrl = `${pathname}${search}`;
|
let currentUrl = parseURL(href);
|
||||||
let currentRef = referrer !== hostname ? referrer : '';
|
let currentRef = referrer !== hostname ? referrer : '';
|
||||||
let title = document.title;
|
let title = document.title;
|
||||||
let cache;
|
let cache;
|
||||||
|
Loading…
Reference in New Issue
Block a user