mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 09:45:04 +01:00
Update display of combined referrer urls.
This commit is contained in:
parent
f113d0cb34
commit
4ab71c42a6
@ -20,9 +20,9 @@ export default function ReferrersTable({ websiteId, websiteDomain, limit, onExpa
|
||||
{ label: <FormattedMessage id="metrics.filter.raw" defaultMessage="Raw" />, value: FILTER_RAW },
|
||||
];
|
||||
|
||||
const renderLink = ({ x: url }) => {
|
||||
return url.startsWith('http') ? (
|
||||
<a href={url} target="_blank" rel="noreferrer">
|
||||
const renderLink = ({ w: href, x: url }) => {
|
||||
return (href || url).startsWith('http') ? (
|
||||
<a href={href || url} target="_blank" rel="noreferrer">
|
||||
{decodeURI(url)}
|
||||
</a>
|
||||
) : (
|
||||
|
@ -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'));
|
||||
};
|
||||
|
||||
|
@ -38,7 +38,7 @@ export const dateLocales = {
|
||||
};
|
||||
|
||||
export const menuOptions = [
|
||||
{ label: 'English', value: 'en', display: 'EN' },
|
||||
{ label: 'English', value: 'en-US', display: 'EN' },
|
||||
{ label: '中文', value: 'zh-CN', display: 'CN' },
|
||||
{ label: 'Deutsch', value: 'de-DE', display: 'DE' },
|
||||
{ label: 'Español', value: 'es-MX', display: 'ES' },
|
||||
|
@ -2,6 +2,10 @@ export function removeTrailingSlash(url) {
|
||||
return url && url.length > 1 && url.endsWith('/') ? url.slice(0, -1) : url;
|
||||
}
|
||||
|
||||
export function removeWWW(url) {
|
||||
return url && url.length > 1 && url.startsWith('www.') ? url.slice(4) : url;
|
||||
}
|
||||
|
||||
export function getDomainName(str) {
|
||||
try {
|
||||
return new URL(str).hostname;
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "umami",
|
||||
"version": "0.35.0",
|
||||
"version": "0.36.0",
|
||||
"description": "A simple, fast, website analytics alternative to Google Analytics. ",
|
||||
"author": "Mike Cao <mike@mikecao.com>",
|
||||
"license": "MIT",
|
||||
|
Loading…
Reference in New Issue
Block a user