Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Add Filter to Have Direct Referrer

Nicholas Faschingfbc33ce746b4
diff --git a/lib/filters.js b/lib/filters.js
index f3237a0aa..f4542083e 100644
--- a/lib/filters.js
+++ b/lib/filters.js
@@ -50,13 +50,15 @@ export const refFilter = (data, { domain, domainOnly, raw }) => {
const links = {};
const isValidRef = referrer => {
- return (
- referrer !== '' && referrer !== null && !referrer.startsWith('/') && !referrer.startsWith('#')
- );
+ return referrer !== null && !referrer.startsWith('/') && !referrer.startsWith('#');
};
const cleanUrl = url => {
try {
+ if (url === '') {
+ return 'direct';
+ }
+
const { hostname, origin, pathname, searchParams, protocol } = new URL(url);
if (regex.test(url)) {