mirror of
https://github.com/umami-software/umami.git
synced 2026-02-12 16:45:35 +01:00
Add Filter to Have Direct Referrer
This commit is contained in:
parent
910f165103
commit
fbc33ce746
1 changed files with 5 additions and 3 deletions
|
|
@ -50,13 +50,15 @@ export const refFilter = (data, { domain, domainOnly, raw }) => {
|
||||||
const links = {};
|
const links = {};
|
||||||
|
|
||||||
const isValidRef = referrer => {
|
const isValidRef = referrer => {
|
||||||
return (
|
return referrer !== null && !referrer.startsWith('/') && !referrer.startsWith('#');
|
||||||
referrer !== '' && referrer !== null && !referrer.startsWith('/') && !referrer.startsWith('#')
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const cleanUrl = url => {
|
const cleanUrl = url => {
|
||||||
try {
|
try {
|
||||||
|
if (url === '') {
|
||||||
|
return 'direct';
|
||||||
|
}
|
||||||
|
|
||||||
const { hostname, origin, pathname, searchParams, protocol } = new URL(url);
|
const { hostname, origin, pathname, searchParams, protocol } = new URL(url);
|
||||||
|
|
||||||
if (regex.test(url)) {
|
if (regex.test(url)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue