mirror of
https://github.com/umami-software/umami.git
synced 2026-02-12 08:37:13 +01:00
Update display of combined referrer urls.
This commit is contained in:
parent
f113d0cb34
commit
4ab71c42a6
5 changed files with 17 additions and 8 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import firstBy from 'thenby';
|
||||
import { BROWSERS, ISO_COUNTRIES } from './constants';
|
||||
import { removeTrailingSlash, getDomainName } from './url';
|
||||
import { removeTrailingSlash, removeWWW, getDomainName } from './url';
|
||||
|
||||
export const urlFilter = (data, { raw }) => {
|
||||
const isValidUrl = url => {
|
||||
|
|
@ -55,6 +55,7 @@ export const urlFilter = (data, { raw }) => {
|
|||
export const refFilter = (data, { domain, domainOnly, raw }) => {
|
||||
const domainName = getDomainName(domain);
|
||||
const regex = new RegExp(`http[s]?://${domainName}`);
|
||||
const links = {};
|
||||
|
||||
const isValidRef = ref => {
|
||||
return ref !== '' && !ref.startsWith('/') && !ref.startsWith('#');
|
||||
|
|
@ -85,7 +86,7 @@ export const refFilter = (data, { domain, domainOnly, raw }) => {
|
|||
const ref = searchParams.get('ref');
|
||||
const query = ref ? `?ref=${ref}` : '';
|
||||
|
||||
return `${origin}${path}${query}`;
|
||||
return removeTrailingSlash(`${removeWWW(hostname)}${path}`) + query;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
@ -101,6 +102,10 @@ export const refFilter = (data, { domain, domainOnly, raw }) => {
|
|||
|
||||
const url = cleanUrl(x);
|
||||
|
||||
if (!domainOnly && !raw) {
|
||||
links[url] = x;
|
||||
}
|
||||
|
||||
if (url) {
|
||||
if (!obj[url]) {
|
||||
obj[url] = y;
|
||||
|
|
@ -113,7 +118,7 @@ export const refFilter = (data, { domain, domainOnly, raw }) => {
|
|||
}, {});
|
||||
|
||||
return Object.keys(map)
|
||||
.map(key => ({ x: key, y: map[key] }))
|
||||
.map(key => ({ x: key, y: map[key], w: links[key] }))
|
||||
.sort(firstBy('y', -1).thenBy('x'));
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue