mirror of
https://github.com/umami-software/umami.git
synced 2026-02-05 21:27:20 +01:00
Merge branch 'dev' into patch-6
This commit is contained in:
commit
9f0d2b1e32
155 changed files with 1334 additions and 1034 deletions
|
|
@ -21,8 +21,12 @@ export function TestConsole({ websiteId }: { websiteId: string }) {
|
|||
router.push(`/console/${value}`);
|
||||
}
|
||||
|
||||
function handleClick() {
|
||||
window['umami'].track({ url: '/page-view', referrer: 'https://www.google.com' });
|
||||
function handleRunScript() {
|
||||
window['umami'].track(props => ({
|
||||
...props,
|
||||
url: '/page-view',
|
||||
referrer: 'https://www.google.com',
|
||||
}));
|
||||
window['umami'].track('track-event-no-data');
|
||||
window['umami'].track('track-event-with-data', {
|
||||
test: 'test-data',
|
||||
|
|
@ -44,7 +48,7 @@ export function TestConsole({ websiteId }: { websiteId: string }) {
|
|||
});
|
||||
}
|
||||
|
||||
function handleIdentifyClick() {
|
||||
function handleRunIdentify() {
|
||||
window['umami'].identify({
|
||||
userId: 123,
|
||||
name: 'brian',
|
||||
|
|
@ -145,10 +149,10 @@ export function TestConsole({ websiteId }: { websiteId: string }) {
|
|||
</div>
|
||||
<div className={styles.group}>
|
||||
<div className={styles.header}>Javascript events</div>
|
||||
<Button id="manual-button" variant="primary" onClick={handleClick}>
|
||||
<Button id="manual-button" variant="primary" onClick={handleRunScript}>
|
||||
Run script
|
||||
</Button>
|
||||
<Button id="manual-button" variant="primary" onClick={handleIdentifyClick}>
|
||||
<Button id="manual-button" variant="primary" onClick={handleRunIdentify}>
|
||||
Run identify
|
||||
</Button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -46,9 +46,14 @@ export function WebsiteHeader({
|
|||
path: '/reports',
|
||||
},
|
||||
{
|
||||
label: formatMessage(labels.eventData),
|
||||
label: formatMessage(labels.sessions),
|
||||
icon: <Icons.User />,
|
||||
path: '/sessions',
|
||||
},
|
||||
{
|
||||
label: formatMessage(labels.events),
|
||||
icon: <Icons.Nodes />,
|
||||
path: '/event-data',
|
||||
path: '/events',
|
||||
},
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -144,7 +144,10 @@ export function RealtimeLog({ data }: { data: RealtimeData }) {
|
|||
const { events, visitors } = data;
|
||||
|
||||
let logs = [
|
||||
...events.map(e => ({ __type: e.eventName ? TYPE_EVENT : TYPE_PAGEVIEW, ...e })),
|
||||
...events.map(e => ({
|
||||
__type: e.eventName ? TYPE_EVENT : TYPE_PAGEVIEW,
|
||||
...e,
|
||||
})),
|
||||
...visitors.map(v => ({ __type: TYPE_SESSION, ...v })),
|
||||
].sort(thenby.firstBy('timestamp', -1));
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
import { useSessions } from 'components/hooks';
|
||||
import SessionsTable from './SessionsTable';
|
||||
import DataTable from 'components/common/DataTable';
|
||||
import { ReactNode } from 'react';
|
||||
|
||||
export default function SessionsDataTable({
|
||||
websiteId,
|
||||
children,
|
||||
}: {
|
||||
websiteId?: string;
|
||||
teamId?: string;
|
||||
children?: ReactNode;
|
||||
}) {
|
||||
const queryResult = useSessions(websiteId);
|
||||
|
||||
if (queryResult?.result?.data?.length === 0) {
|
||||
return children;
|
||||
}
|
||||
|
||||
return (
|
||||
<DataTable queryResult={queryResult} allowSearch={false}>
|
||||
{({ data }) => <SessionsTable data={data} showDomain={!websiteId} />}
|
||||
</DataTable>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
'use client';
|
||||
import WebsiteHeader from '../WebsiteHeader';
|
||||
import SessionsDataTable from './SessionsDataTable';
|
||||
|
||||
export function SessionsPage({ websiteId }) {
|
||||
return (
|
||||
<>
|
||||
<WebsiteHeader websiteId={websiteId} />
|
||||
<SessionsDataTable websiteId={websiteId} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default SessionsPage;
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
import { GridColumn, GridTable, useBreakpoint } from 'react-basics';
|
||||
import { useMessages } from 'components/hooks';
|
||||
|
||||
export function SessionsTable({ data = [] }: { data: any[]; showDomain?: boolean }) {
|
||||
const { formatMessage, labels } = useMessages();
|
||||
const breakpoint = useBreakpoint();
|
||||
|
||||
return (
|
||||
<GridTable data={data} cardMode={['xs', 'sm', 'md'].includes(breakpoint)}>
|
||||
<GridColumn name="id" label="ID" />
|
||||
<GridColumn name="country" label={formatMessage(labels.country)} />
|
||||
<GridColumn name="city" label={formatMessage(labels.city)} />
|
||||
<GridColumn name="browser" label={formatMessage(labels.browser)} />
|
||||
<GridColumn name="os" label={formatMessage(labels.os)} />
|
||||
<GridColumn name="device" label={formatMessage(labels.device)} />
|
||||
<GridColumn name="createdAt" label={formatMessage(labels.created)} />
|
||||
</GridTable>
|
||||
);
|
||||
}
|
||||
|
||||
export default SessionsTable;
|
||||
10
src/app/(main)/websites/[websiteId]/sessions/page.tsx
Normal file
10
src/app/(main)/websites/[websiteId]/sessions/page.tsx
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import SessionsPage from './SessionsPage';
|
||||
import { Metadata } from 'next';
|
||||
|
||||
export default function ({ params: { websiteId } }) {
|
||||
return <SessionsPage websiteId={websiteId} />;
|
||||
}
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'Sessions',
|
||||
};
|
||||
28
src/app/api/scripts/telemetry/route.ts
Normal file
28
src/app/api/scripts/telemetry/route.ts
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import { CURRENT_VERSION, TELEMETRY_PIXEL } from 'lib/constants';
|
||||
|
||||
export async function GET() {
|
||||
if (
|
||||
process.env.NODE_ENV !== 'production' &&
|
||||
process.env.DISABLE_TELEMETRY &&
|
||||
process.env.PRIVATE_MODE
|
||||
) {
|
||||
const script = `
|
||||
(()=>{const i=document.createElement('img');
|
||||
i.setAttribute('src','${TELEMETRY_PIXEL}?v=${CURRENT_VERSION}');
|
||||
i.setAttribute('style','width:0;height:0;position:absolute;pointer-events:none;');
|
||||
document.body.appendChild(i);})();
|
||||
`;
|
||||
|
||||
return new Response(script.replace(/\s\s+/g, ''), {
|
||||
headers: {
|
||||
'content-type': 'text/javascript',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return new Response('/* telemetry disabled */', {
|
||||
headers: {
|
||||
'content-type': 'text/javascript',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ export * from './queries/useLogin';
|
|||
export * from './queries/useRealtime';
|
||||
export * from './queries/useReport';
|
||||
export * from './queries/useReports';
|
||||
export * from './queries/useSessions';
|
||||
export * from './queries/useShareToken';
|
||||
export * from './queries/useTeam';
|
||||
export * from './queries/useTeams';
|
||||
|
|
|
|||
20
src/components/hooks/queries/useSessions.ts
Normal file
20
src/components/hooks/queries/useSessions.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { useApi } from './useApi';
|
||||
import { useFilterQuery } from './useFilterQuery';
|
||||
import useModified from '../useModified';
|
||||
|
||||
export function useSessions(websiteId: string, params?: { [key: string]: string | number }) {
|
||||
const { get } = useApi();
|
||||
const { modified } = useModified(`websites`);
|
||||
|
||||
return useFilterQuery({
|
||||
queryKey: ['sessions', { websiteId, modified, ...params }],
|
||||
queryFn: (data: any) => {
|
||||
return get(`/websites/${websiteId}/sessions`, {
|
||||
...data,
|
||||
...params,
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export default useSessions;
|
||||
|
|
@ -265,7 +265,7 @@ export const labels = defineMessages({
|
|||
journey: { id: 'label.journey', defaultMessage: 'Journey' },
|
||||
journeyDescription: {
|
||||
id: 'label.journey-description',
|
||||
defaultMessage: 'Understand how users nagivate through your website.',
|
||||
defaultMessage: 'Understand how users navigate through your website.',
|
||||
},
|
||||
compare: { id: 'label.compare', defaultMessage: 'Compare' },
|
||||
current: { id: 'label.current', defaultMessage: 'Current' },
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Language",
|
||||
"label.languages": "Languages",
|
||||
"label.laptop": "Laptop",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "انضم",
|
||||
"label.join-team": "انضم للفريق",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "اللغة",
|
||||
"label.languages": "اللغات",
|
||||
"label.laptop": "لابتوب",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Мова",
|
||||
"label.languages": "Мовы",
|
||||
"label.laptop": "Ноўтбук",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Присъедини се",
|
||||
"label.join-team": "Присъедини се към екип",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Език",
|
||||
"label.languages": "Езици",
|
||||
"label.laptop": "Лаптоп",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "ভাষা",
|
||||
"label.languages": "ভাষা",
|
||||
"label.laptop": "ল্যাপটপ",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Učlani se",
|
||||
"label.join-team": "Učlani se u tim",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Jezik",
|
||||
"label.languages": "Jezici",
|
||||
"label.laptop": "Laptop",
|
||||
|
|
|
|||
|
|
@ -24,12 +24,12 @@
|
|||
"label.cities": "Ciutats",
|
||||
"label.city": "Ciutat",
|
||||
"label.clear-all": "Netejar tot",
|
||||
"label.compare": "Compare",
|
||||
"label.compare": "Comparar",
|
||||
"label.confirm": "Confirmar",
|
||||
"label.confirm-password": "Confirma la contrasenya",
|
||||
"label.contains": "Conté",
|
||||
"label.continue": "Continuar",
|
||||
"label.count": "Count",
|
||||
"label.count": "Recompte",
|
||||
"label.countries": "Països",
|
||||
"label.country": "País",
|
||||
"label.create": "Crear",
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
"label.create-user": "Crear usuari",
|
||||
"label.created": "Creat",
|
||||
"label.created-by": "Creat Per",
|
||||
"label.current": "Current",
|
||||
"label.current": "Actual",
|
||||
"label.current-password": "Contrasenya actual",
|
||||
"label.custom-range": "Rang personalitzat",
|
||||
"label.dashboard": "Panell",
|
||||
|
|
@ -65,12 +65,12 @@
|
|||
"label.edit-dashboard": "Edita panell",
|
||||
"label.edit-member": "Edita membre",
|
||||
"label.enable-share-url": "Activa l'enllaç per compartir",
|
||||
"label.end-step": "End Step",
|
||||
"label.entry": "Entry URL",
|
||||
"label.end-step": "Pas Final",
|
||||
"label.entry": "URL d'entrada",
|
||||
"label.event": "Esdeveniment",
|
||||
"label.event-data": "Dades de l'esdeveniment",
|
||||
"label.events": "Esdeveniments",
|
||||
"label.exit": "Exit URL",
|
||||
"label.exit": "URL de sortida",
|
||||
"label.false": "Fals",
|
||||
"label.field": "Camp",
|
||||
"label.fields": "Camps",
|
||||
|
|
@ -80,13 +80,13 @@
|
|||
"label.filters": "Filtres",
|
||||
"label.funnel": "Embut",
|
||||
"label.funnel-description": "Entengui la taxa de conversió i abandonament dels usuaris.",
|
||||
"label.goal": "Goal",
|
||||
"label.goals": "Goals",
|
||||
"label.goals-description": "Track your goals for pageviews and events.",
|
||||
"label.goal": "Meta",
|
||||
"label.goals": "Metes",
|
||||
"label.goals-description": "Feu un seguiment de les seves metes per a pàgines vistes i esdeveniments.",
|
||||
"label.greater-than": "Més gran que",
|
||||
"label.greater-than-equals": "Més gran que o igual a",
|
||||
"label.host": "Host",
|
||||
"label.hosts": "Hosts",
|
||||
"label.host": "Amfitrió",
|
||||
"label.hosts": "Amfitrions",
|
||||
"label.insights": "Insights",
|
||||
"label.insights-description": "Aprofundeixi en les seves dades mitjançant l'ús de segments i filtres.",
|
||||
"label.is": "És igual a",
|
||||
|
|
@ -95,8 +95,8 @@
|
|||
"label.is-set": "Està establert",
|
||||
"label.join": "Unir",
|
||||
"label.join-team": "Unir-se al equip",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey": "Trajecte",
|
||||
"label.journey-description": "Entengui com naveguen els usuaris pel seu lloc web.",
|
||||
"label.language": "Idioma",
|
||||
"label.languages": "Idiomes",
|
||||
"label.laptop": "Portàtil",
|
||||
|
|
@ -122,7 +122,7 @@
|
|||
"label.name": "Nom",
|
||||
"label.new-password": "Contrasenya nova",
|
||||
"label.none": "Cap",
|
||||
"label.number-of-records": "{x} {x, plural, one {record} other {records}}",
|
||||
"label.number-of-records": "{x} {x, plural, one {registre} other {registres}}",
|
||||
"label.ok": "OK",
|
||||
"label.os": "SO",
|
||||
"label.overview": "Resum",
|
||||
|
|
@ -133,11 +133,11 @@
|
|||
"label.pages": "Pàgines",
|
||||
"label.password": "Contrasenya",
|
||||
"label.powered-by": "Funciona amb {name}",
|
||||
"label.previous": "Previous",
|
||||
"label.previous-period": "Previous period",
|
||||
"label.previous-year": "Previous year",
|
||||
"label.previous": "Anterior",
|
||||
"label.previous-period": "Període anterior",
|
||||
"label.previous-year": "Any anterior",
|
||||
"label.profile": "Perfil",
|
||||
"label.property": "Property",
|
||||
"label.property": "Propietat",
|
||||
"label.queries": "Consultes",
|
||||
"label.query": "Consulta",
|
||||
"label.query-parameters": "Paràmetres de consulta",
|
||||
|
|
@ -169,7 +169,7 @@
|
|||
"label.settings": "Configuració",
|
||||
"label.share-url": "Enllaç per compartir",
|
||||
"label.single-day": "Un sol dia",
|
||||
"label.start-step": "Start Step",
|
||||
"label.start-step": "Pas inicial",
|
||||
"label.steps": "Pasos",
|
||||
"label.sum": "Suma",
|
||||
"label.tablet": "Tauleta",
|
||||
|
|
@ -214,7 +214,7 @@
|
|||
"label.view-details": "Veure els detalls",
|
||||
"label.view-only": "Només veure",
|
||||
"label.views": "Vistes",
|
||||
"label.views-per-visit": "Views per visit",
|
||||
"label.views-per-visit": "Vistes per visita",
|
||||
"label.visit-duration": "Temps mitjà de visita",
|
||||
"label.visitors": "Visitants",
|
||||
"label.visits": "Visites",
|
||||
|
|
@ -225,7 +225,7 @@
|
|||
"label.yesterday": "Ahir",
|
||||
"message.action-confirmation": "Escrigui {confirmation} al cuadre inferior per confirmar.",
|
||||
"message.active-users": "{x} {x, plural, one {visitant actual} other {visitants actuals}}",
|
||||
"message.collected-data": "Collected data",
|
||||
"message.collected-data": "Dades recol·lectades",
|
||||
"message.confirm-delete": "Segur que vol esborrar {target}?",
|
||||
"message.confirm-leave": "Segur que vol abandonar {target}?",
|
||||
"message.confirm-remove": "Segur que vol eliminar {target}?",
|
||||
|
|
@ -263,5 +263,5 @@
|
|||
"message.user-deleted": "Usuari eliminat.",
|
||||
"message.viewed-page": "Pàgina vista",
|
||||
"message.visitor-log": "Visitant de {country} usant {browser} a {os} {device}",
|
||||
"message.visitors-dropped-off": "Els visitants han sortit"
|
||||
"message.visitors-dropped-off": "Visitants han sortit"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Language",
|
||||
"label.languages": "Languages",
|
||||
"label.laptop": "Přenosný počítač",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Sprog",
|
||||
"label.languages": "Sprog",
|
||||
"label.laptop": "Laptop",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Biträte",
|
||||
"label.join-team": "Team biträte",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Sprach",
|
||||
"label.languages": "Sprache",
|
||||
"label.laptop": "Laptop",
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
"label.activity-log": "Aktivitätsverlauf",
|
||||
"label.add": "Hinzufügen",
|
||||
"label.add-description": "Beschreibung hinzufügen",
|
||||
"label.add-member": "Add member",
|
||||
"label.add-step": "Add step",
|
||||
"label.add-member": "Mitglied hinzufügen",
|
||||
"label.add-step": "Schritt hinzufügen",
|
||||
"label.add-website": "Website hinzufügen",
|
||||
"label.admin": "Administrator",
|
||||
"label.after": "Nach",
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
"label.back": "Zurück",
|
||||
"label.before": "Vor",
|
||||
"label.bounce-rate": "Absprungrate",
|
||||
"label.breakdown": "Breakdown",
|
||||
"label.breakdown": "Aufschlüsselung",
|
||||
"label.browser": "Browser",
|
||||
"label.browsers": "Browser",
|
||||
"label.cancel": "Abbrechen",
|
||||
|
|
@ -24,21 +24,21 @@
|
|||
"label.cities": "Städte",
|
||||
"label.city": "Stadt",
|
||||
"label.clear-all": "Alles löschen",
|
||||
"label.compare": "Compare",
|
||||
"label.compare": "Vergleich",
|
||||
"label.confirm": "Bestätigen",
|
||||
"label.confirm-password": "Passwort wiederholen",
|
||||
"label.contains": "Enthält",
|
||||
"label.continue": "Weiter",
|
||||
"label.count": "Count",
|
||||
"label.count": "Anzahl",
|
||||
"label.countries": "Länder",
|
||||
"label.country": "Land",
|
||||
"label.create": "Create",
|
||||
"label.create": "Erstellen",
|
||||
"label.create-report": "Bericht erstellen",
|
||||
"label.create-team": "Team erstellen",
|
||||
"label.create-user": "Benutzer erstellen",
|
||||
"label.created": "Erstellt",
|
||||
"label.created-by": "Created By",
|
||||
"label.current": "Current",
|
||||
"label.created-by": "Erstellt von",
|
||||
"label.current": "Aktuell",
|
||||
"label.current-password": "Derzeitiges Passwort",
|
||||
"label.custom-range": "Benutzerdefinierter Bereich",
|
||||
"label.dashboard": "Übersicht",
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
"label.day": "Tag",
|
||||
"label.default-date-range": "Voreingestellter Datumsbereich",
|
||||
"label.delete": "Löschen",
|
||||
"label.delete-report": "Delete report",
|
||||
"label.delete-report": "Bericht löschen",
|
||||
"label.delete-team": "Team löschen",
|
||||
"label.delete-user": "Benutzer löschen",
|
||||
"label.delete-website": "Website löschen",
|
||||
|
|
@ -63,9 +63,9 @@
|
|||
"label.dropoff": "Dropoff",
|
||||
"label.edit": "Bearbeiten",
|
||||
"label.edit-dashboard": "Dashboard bearbeiten",
|
||||
"label.edit-member": "Edit member",
|
||||
"label.edit-member": "Mitglied bearbeiten",
|
||||
"label.enable-share-url": "Freigabe-URL aktivieren",
|
||||
"label.end-step": "End Step",
|
||||
"label.end-step": "Schritt beenden",
|
||||
"label.entry": "Entry URL",
|
||||
"label.event": "Event",
|
||||
"label.event-data": "Eventdaten",
|
||||
|
|
@ -79,16 +79,16 @@
|
|||
"label.filter-raw": "Rohdaten",
|
||||
"label.filters": "Filter",
|
||||
"label.funnel": "Funnel",
|
||||
"label.funnel-description": "Understand the conversion and drop-off rate of users.",
|
||||
"label.goal": "Goal",
|
||||
"label.goals": "Goals",
|
||||
"label.goals-description": "Track your goals for pageviews and events.",
|
||||
"label.funnel-description": "Verstehe die Konversions- und Dropoffrate von Nutzern.",
|
||||
"label.goal": "Ziel",
|
||||
"label.goals": "Ziele",
|
||||
"label.goals-description": "Verfolgen Sie Ihre Ziele für Aufrufe und Events.",
|
||||
"label.greater-than": "Größer als",
|
||||
"label.greater-than-equals": "Größer oder gleich",
|
||||
"label.host": "Host",
|
||||
"label.hosts": "Hosts",
|
||||
"label.insights": "Insights",
|
||||
"label.insights-description": "Dive deeper into your data by using segments and filters.",
|
||||
"label.insights-description": "Tauchen Sie tiefer in Ihre Daten mit Filtern und Segmenten ein.",
|
||||
"label.is": "Ist",
|
||||
"label.is-not": "Ist nicht",
|
||||
"label.is-not-set": "Ist nicht gesetzt",
|
||||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Beitreten",
|
||||
"label.join-team": "Team beitreten",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Verstehen Sie, wie Nutzer Ihre Website navigieren.",
|
||||
"label.language": "Sprache",
|
||||
"label.languages": "Sprachen",
|
||||
"label.laptop": "Laptop",
|
||||
|
|
@ -109,15 +109,15 @@
|
|||
"label.less-than-equals": "Kleiner oder gleich",
|
||||
"label.login": "Anmelden",
|
||||
"label.logout": "Abmelden",
|
||||
"label.manage": "Manage",
|
||||
"label.manage": "Verwalten",
|
||||
"label.manager": "Manager",
|
||||
"label.max": "Max",
|
||||
"label.member": "Member",
|
||||
"label.member": "Mitglied",
|
||||
"label.members": "Mitglieder",
|
||||
"label.min": "Min",
|
||||
"label.mobile": "Handy",
|
||||
"label.more": "Mehr",
|
||||
"label.my-account": "My account",
|
||||
"label.my-account": "Mein Konto",
|
||||
"label.my-websites": "Meine Websites",
|
||||
"label.name": "Name",
|
||||
"label.new-password": "Neues Passwort",
|
||||
|
|
@ -133,11 +133,11 @@
|
|||
"label.pages": "Seiten",
|
||||
"label.password": "Passwort",
|
||||
"label.powered-by": "Betrieben durch {name}",
|
||||
"label.previous": "Previous",
|
||||
"label.previous-period": "Previous period",
|
||||
"label.previous-year": "Previous year",
|
||||
"label.previous": "Vorherige",
|
||||
"label.previous-period": "Vorheriger Zeitraum",
|
||||
"label.previous-year": "Vorheriges Jahr",
|
||||
"label.profile": "Profil",
|
||||
"label.property": "Property",
|
||||
"label.property": "Besitz",
|
||||
"label.queries": "Abfragen",
|
||||
"label.query": "Abfrage",
|
||||
"label.query-parameters": "Abfrageparameter",
|
||||
|
|
@ -149,33 +149,33 @@
|
|||
"label.region": "Region",
|
||||
"label.regions": "Regionen",
|
||||
"label.remove": "Entfernen",
|
||||
"label.remove-member": "Remove member",
|
||||
"label.remove-member": "Mitglied entfernen",
|
||||
"label.reports": "Berichte",
|
||||
"label.required": "Erforderlich",
|
||||
"label.reset": "Zurücksetzen",
|
||||
"label.reset-website": "Statistik zurücksetzen",
|
||||
"label.retention": "Retention",
|
||||
"label.retention-description": "Measure your website stickiness by tracking how often users return.",
|
||||
"label.retention-description": "Messen Sie die Presenz Ihrer Website, indem Sie tracken wie oft Nutzer zurückkehren.",
|
||||
"label.role": "Rolle",
|
||||
"label.run-query": "Abfrage starten",
|
||||
"label.save": "Speichern",
|
||||
"label.screens": "Bildschirmauflösungen",
|
||||
"label.search": "Search",
|
||||
"label.select": "Select",
|
||||
"label.search": "Suche",
|
||||
"label.select": "Auswählen",
|
||||
"label.select-date": "Datum auswählen",
|
||||
"label.select-role": "Select role",
|
||||
"label.select-role": "Rolle auswählen",
|
||||
"label.select-website": "Website auswählen",
|
||||
"label.sessions": "Sitzungen",
|
||||
"label.settings": "Einstellungen",
|
||||
"label.share-url": "Freigabe-URL",
|
||||
"label.single-day": "Ein Tag",
|
||||
"label.start-step": "Start Step",
|
||||
"label.steps": "Steps",
|
||||
"label.start-step": "Schritt starten",
|
||||
"label.steps": "Schritte",
|
||||
"label.sum": "Summe",
|
||||
"label.tablet": "Tablet",
|
||||
"label.team": "Team",
|
||||
"label.team-id": "Team-ID",
|
||||
"label.team-manager": "Team manager",
|
||||
"label.team-manager": "Team-Manager",
|
||||
"label.team-member": "Team-Mitglied",
|
||||
"label.team-name": "Name des Teams",
|
||||
"label.team-owner": "Team-Eigentümer",
|
||||
|
|
@ -193,8 +193,8 @@
|
|||
"label.total": "Gesamt",
|
||||
"label.total-records": "Datensätze insgesamt",
|
||||
"label.tracking-code": "Tracking Code",
|
||||
"label.transfer": "Transfer",
|
||||
"label.transfer-website": "Transfer website",
|
||||
"label.transfer": "Übertragung",
|
||||
"label.transfer-website": "Website übertragen",
|
||||
"label.true": "Wahr",
|
||||
"label.type": "Typ",
|
||||
"label.unique": "Eindeutig",
|
||||
|
|
@ -208,29 +208,29 @@
|
|||
"label.username": "Benutzername",
|
||||
"label.users": "Benutzer",
|
||||
"label.utm": "UTM",
|
||||
"label.utm-description": "Track your campaigns through UTM parameters.",
|
||||
"label.utm-description": "Tracken Sie Ihre Kampagnen mit Hilfe von UTM Parametern.",
|
||||
"label.value": "Wert",
|
||||
"label.view": "Anzeigen",
|
||||
"label.view-details": "Details anzeigen",
|
||||
"label.view-only": "Nur ansehen",
|
||||
"label.views": "Aufrufe",
|
||||
"label.views-per-visit": "Views per visit",
|
||||
"label.views-per-visit": "Aufrufe pro Besuch",
|
||||
"label.visit-duration": "Durchschn. Besuchszeit",
|
||||
"label.visitors": "Besucher",
|
||||
"label.visits": "Visits",
|
||||
"label.visits": "Besuche",
|
||||
"label.website": "Website",
|
||||
"label.website-id": "Website ID",
|
||||
"label.websites": "Websites",
|
||||
"label.window": "Fenster",
|
||||
"label.yesterday": "Gestern",
|
||||
"message.action-confirmation": "Type {confirmation} in the box below to confirm.",
|
||||
"message.action-confirmation": "Tippen Sie {confirmation} in das untenliegende Feld, um zu bestätigen.",
|
||||
"message.active-users": "{x} {x, plural, one {aktiver Besucher} other {aktive Besucher}}",
|
||||
"message.collected-data": "Collected data",
|
||||
"message.collected-data": "Gesammelte Daten",
|
||||
"message.confirm-delete": "Sind Sie sich sicher, {target} zu löschen?",
|
||||
"message.confirm-leave": "Sind Sie sicher, dass die {target} verlassen möchten?",
|
||||
"message.confirm-remove": "Are you sure you want to remove {target}?",
|
||||
"message.confirm-remove": "Sind Sie sicher, dass Sie {target} entfernen möchten?",
|
||||
"message.confirm-reset": "Sind Sie sicher, dass Sie die Statistiken von {target} zurücksetzen wollen?",
|
||||
"message.delete-team-warning": "Deleting a team will also delete all team websites.",
|
||||
"message.delete-team-warning": "Alle zugehörigen Websiten werden ebenfalls gelöscht.",
|
||||
"message.delete-website-warning": "Alle zugehörigen Daten werden ebenfalls gelöscht.",
|
||||
"message.error": "Es ist ein Fehler aufgetreten.",
|
||||
"message.event-log": "{event} auf {url}",
|
||||
|
|
@ -256,12 +256,12 @@
|
|||
"message.team-not-found": "Team nicht gefunden.",
|
||||
"message.team-websites-info": "Websites können von jedem im Team eingesehen werden.",
|
||||
"message.tracking-code": "Tracking Code",
|
||||
"message.transfer-team-website-to-user": "Transfer this website to your account?",
|
||||
"message.transfer-user-website-to-team": "Select the team to transfer this website to.",
|
||||
"message.transfer-website": "Transfer website ownership to your account or another team.",
|
||||
"message.triggered-event": "Triggered event",
|
||||
"message.transfer-team-website-to-user": "Möchten Sie diese Website auf Ihr Konto übertragen?",
|
||||
"message.transfer-user-website-to-team": "Wählen Sie das Team, auf das die Website übertragen wird.",
|
||||
"message.transfer-website": "Übertragen Sie den Besitz der Website auf Ihren Account oder ein anderes Team.",
|
||||
"message.triggered-event": "Event ausgelöst",
|
||||
"message.user-deleted": "Benutzer gelöscht.",
|
||||
"message.viewed-page": "Viewed page",
|
||||
"message.viewed-page": "Seite besucht",
|
||||
"message.visitor-log": "Besucher aus {country} benutzt {browser} auf {os} {device}",
|
||||
"message.visitors-dropped-off": "Visitors dropped off"
|
||||
"message.visitors-dropped-off": "Besucher haben die Seite verlassen"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Language",
|
||||
"label.languages": "Languages",
|
||||
"label.laptop": "Λάπτοπ",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Language",
|
||||
"label.languages": "Languages",
|
||||
"label.laptop": "Laptop",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Language",
|
||||
"label.languages": "Languages",
|
||||
"label.laptop": "Laptop",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Unir",
|
||||
"label.join-team": "Unirse al equipo",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Idioma",
|
||||
"label.languages": "Idiomas",
|
||||
"label.laptop": "Portátil",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "زبان",
|
||||
"label.languages": "زبانها",
|
||||
"label.laptop": "لپتاپ",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Kieli",
|
||||
"label.languages": "Kielet",
|
||||
"label.laptop": "Kannettava tietokone",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Language",
|
||||
"label.languages": "Languages",
|
||||
"label.laptop": "Fartelda",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Rejoindre",
|
||||
"label.join-team": "Rejoindre une équipe",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Langue",
|
||||
"label.languages": "Langues",
|
||||
"label.laptop": "Portable",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Idioma",
|
||||
"label.languages": "Idiomas",
|
||||
"label.laptop": "Portátil",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Language",
|
||||
"label.languages": "Languages",
|
||||
"label.laptop": "לפטופ",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Language",
|
||||
"label.languages": "Languages",
|
||||
"label.laptop": "लैपटॉप",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Jezik",
|
||||
"label.languages": "Languages",
|
||||
"label.laptop": "Laptop",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Language",
|
||||
"label.languages": "Languages",
|
||||
"label.laptop": "Laptop",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Bahasa",
|
||||
"label.languages": "Bahasa",
|
||||
"label.laptop": "Laptop",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Lingua",
|
||||
"label.languages": "Lingue",
|
||||
"label.laptop": "Portatile",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "参加",
|
||||
"label.join-team": "チームに参加",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "言語",
|
||||
"label.languages": "言語",
|
||||
"label.laptop": "ノートPC",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "ភាសា",
|
||||
"label.languages": "ភាសា",
|
||||
"label.laptop": "កុំព្យូទ័រយួរដៃ",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Prisijungti",
|
||||
"label.join-team": "Prisijungti į komandą",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Kalba",
|
||||
"label.languages": "Kalbos",
|
||||
"label.laptop": "Laptop",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Нэгдэх",
|
||||
"label.join-team": "Багт нэгдэх",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Хэл",
|
||||
"label.languages": "Хэл",
|
||||
"label.laptop": "Зөөврийн компьютер",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Language",
|
||||
"label.languages": "Languages",
|
||||
"label.laptop": "Laptop",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "ဝင်မည်",
|
||||
"label.join-team": "အသင်းဝင်မည်",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "ဘာသာစကား",
|
||||
"label.languages": "ဘာသာစကားများ",
|
||||
"label.laptop": "လက်တော့ပ်",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Språk",
|
||||
"label.languages": "Språk",
|
||||
"label.laptop": "Bærbar",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Lid worden",
|
||||
"label.join-team": "Word lid van een team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Taal",
|
||||
"label.languages": "Talen",
|
||||
"label.laptop": "Laptop",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Dołącz",
|
||||
"label.join-team": "Dołącz do zespołu",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Język",
|
||||
"label.languages": "Języki",
|
||||
"label.laptop": "Laptop",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Participar",
|
||||
"label.join-team": "Participar da equipe",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Idioma",
|
||||
"label.languages": "Idiomas",
|
||||
"label.laptop": "Notebook",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Língua",
|
||||
"label.languages": "Línguas",
|
||||
"label.laptop": "Portátil",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Alătură-te",
|
||||
"label.join-team": "Alătură-te echipei",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Limbă",
|
||||
"label.languages": "Limbi",
|
||||
"label.laptop": "Laptop",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Присоединиться",
|
||||
"label.join-team": "Присоединиться к команде",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Язык",
|
||||
"label.languages": "Языки",
|
||||
"label.laptop": "Ноутбук",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "භාෂාව",
|
||||
"label.languages": "Languages",
|
||||
"label.laptop": "Laptop",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Language",
|
||||
"label.languages": "Languages",
|
||||
"label.laptop": "Prenosný počítač",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Pridruži se",
|
||||
"label.join-team": "Pridruži se ekipi",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Jezik",
|
||||
"label.languages": "Jeziki",
|
||||
"label.laptop": "Prenosni računalnik",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Gå med",
|
||||
"label.join-team": "Gå med i team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Språk",
|
||||
"label.languages": "Språk",
|
||||
"label.laptop": "Bärbar",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Language",
|
||||
"label.languages": "Languages",
|
||||
"label.laptop": "மடிக்கணினி",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "ภาษา",
|
||||
"label.languages": "ภาษา",
|
||||
"label.laptop": "แล็ปท็อป",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Katıl",
|
||||
"label.join-team": "Takıma katıl",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Dil",
|
||||
"label.languages": "Diller",
|
||||
"label.laptop": "Dizüstü",
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@
|
|||
"label.join": "Приєднатись",
|
||||
"label.join-team": "Приєднатись до команди",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Мова",
|
||||
"label.languages": "Мови",
|
||||
"label.laptop": "Ноутбук",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Language",
|
||||
"label.languages": "زبانیں",
|
||||
"label.laptop": "لیپ ٹاپ",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "Join",
|
||||
"label.join-team": "Join team",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "Language",
|
||||
"label.languages": "Ngôn ngữ",
|
||||
"label.laptop": "Laptop",
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@
|
|||
"label.new-password": "新密码",
|
||||
"label.none": "无",
|
||||
"label.number-of-records": "{x} {x, plural, one {record} other {records}}",
|
||||
"label.ok": "OK",
|
||||
"label.ok": "好的",
|
||||
"label.os": "操作系统",
|
||||
"label.overview": "概览",
|
||||
"label.owner": "所有者",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
"label.join": "加入",
|
||||
"label.join-team": "加入團隊",
|
||||
"label.journey": "Journey",
|
||||
"label.journey-description": "Understand how users nagivate through your website.",
|
||||
"label.journey-description": "Understand how users navigate through your website.",
|
||||
"label.language": "語言",
|
||||
"label.languages": "語言",
|
||||
"label.laptop": "筆記型電腦",
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ import { ClickHouseClient, createClient } from '@clickhouse/client';
|
|||
import dateFormat from 'dateformat';
|
||||
import debug from 'debug';
|
||||
import { CLICKHOUSE } from 'lib/db';
|
||||
import { QueryFilters, QueryOptions } from './types';
|
||||
import { OPERATORS } from './constants';
|
||||
import { PageParams, QueryFilters, QueryOptions } from './types';
|
||||
import { DEFAULT_PAGE_SIZE, OPERATORS } from './constants';
|
||||
import { fetchWebsite } from './load';
|
||||
import { maxDate } from './date';
|
||||
import { filtersToArray } from './params';
|
||||
|
|
@ -32,7 +32,7 @@ function getClient() {
|
|||
} = new URL(process.env.CLICKHOUSE_URL);
|
||||
|
||||
const client = createClient({
|
||||
host: `${protocol}//${hostname}:${port}`,
|
||||
url: `${protocol}//${hostname}:${port}`,
|
||||
database: pathname.replace('/', ''),
|
||||
username: username,
|
||||
password,
|
||||
|
|
@ -47,11 +47,11 @@ function getClient() {
|
|||
return client;
|
||||
}
|
||||
|
||||
function getDateStringQuery(data: any, unit: string | number) {
|
||||
function getDateStringSQL(data: any, unit: string | number) {
|
||||
return `formatDateTime(${data}, '${CLICKHOUSE_DATE_FORMATS[unit]}')`;
|
||||
}
|
||||
|
||||
function getDateQuery(field: string, unit: string, timezone?: string) {
|
||||
function getDateSQL(field: string, unit: string, timezone?: string) {
|
||||
if (timezone) {
|
||||
return `date_trunc('${unit}', ${field}, '${timezone}')`;
|
||||
}
|
||||
|
|
@ -95,6 +95,20 @@ function getFilterQuery(filters: QueryFilters = {}, options: QueryOptions = {})
|
|||
return query.join('\n');
|
||||
}
|
||||
|
||||
function getDateQuery(filters: QueryFilters = {}) {
|
||||
const { startDate, endDate } = filters;
|
||||
|
||||
if (startDate) {
|
||||
if (endDate) {
|
||||
return `and created_at between {startDate:DateTime64} and {endDate:DateTime64}`;
|
||||
} else {
|
||||
return `and created_at >= {startDate:DateTime64}`;
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
function getFilterParams(filters: QueryFilters = {}) {
|
||||
return filtersToArray(filters).reduce((obj, { name, value }) => {
|
||||
if (name && value !== undefined) {
|
||||
|
|
@ -110,6 +124,7 @@ async function parseFilters(websiteId: string, filters: QueryFilters = {}, optio
|
|||
|
||||
return {
|
||||
filterQuery: getFilterQuery(filters, options),
|
||||
dateQuery: getDateQuery(filters),
|
||||
params: {
|
||||
...getFilterParams(filters),
|
||||
websiteId,
|
||||
|
|
@ -119,6 +134,32 @@ async function parseFilters(websiteId: string, filters: QueryFilters = {}, optio
|
|||
};
|
||||
}
|
||||
|
||||
async function pagedQuery(
|
||||
query: string,
|
||||
queryParams: { [key: string]: any },
|
||||
pageParams: PageParams = {},
|
||||
) {
|
||||
const { page = 1, pageSize, orderBy, sortDescending = false } = pageParams;
|
||||
const size = +pageSize || DEFAULT_PAGE_SIZE;
|
||||
const offset = +size * (page - 1);
|
||||
const direction = sortDescending ? 'desc' : 'asc';
|
||||
|
||||
const statements = [
|
||||
orderBy && `order by ${orderBy} ${direction}`,
|
||||
+size > 0 && `limit ${+size} offset ${offset}`,
|
||||
]
|
||||
.filter(n => n)
|
||||
.join('\n');
|
||||
|
||||
const count = await rawQuery(`select count(*) as num from (${query}) t`, queryParams).then(
|
||||
res => res[0].num,
|
||||
);
|
||||
|
||||
const data = await rawQuery(`${query}${statements}`, queryParams);
|
||||
|
||||
return { data, count, page: +page, pageSize: size, orderBy };
|
||||
}
|
||||
|
||||
async function rawQuery<T = unknown>(
|
||||
query: string,
|
||||
params: Record<string, unknown> = {},
|
||||
|
|
@ -136,7 +177,13 @@ async function rawQuery<T = unknown>(
|
|||
format: 'JSONEachRow',
|
||||
});
|
||||
|
||||
return resultSet.json();
|
||||
return resultSet.json() as T;
|
||||
}
|
||||
|
||||
async function insert(table: string, values: any[]) {
|
||||
await connect();
|
||||
|
||||
return clickhouse.insert({ table, values, format: 'JSONEachRow' });
|
||||
}
|
||||
|
||||
async function findUnique(data: any[]) {
|
||||
|
|
@ -164,12 +211,14 @@ export default {
|
|||
client: clickhouse,
|
||||
log,
|
||||
connect,
|
||||
getDateStringQuery,
|
||||
getDateQuery,
|
||||
getDateStringSQL,
|
||||
getDateSQL,
|
||||
getDateFormat,
|
||||
getFilterQuery,
|
||||
parseFilters,
|
||||
pagedQuery,
|
||||
findUnique,
|
||||
findFirst,
|
||||
rawQuery,
|
||||
insert,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@ import path from 'path';
|
|||
import { getClientIp } from 'request-ip';
|
||||
import { browserName, detectOS } from 'detect-browser';
|
||||
import isLocalhost from 'is-localhost-ip';
|
||||
import ipaddr from 'ipaddr.js';
|
||||
import maxmind from 'maxmind';
|
||||
import { safeDecodeURIComponent } from 'next-basics';
|
||||
|
||||
import {
|
||||
DESKTOP_OS,
|
||||
MOBILE_OS,
|
||||
|
|
@ -137,3 +137,31 @@ export async function getClientInfo(req: NextApiRequestCollect) {
|
|||
|
||||
return { userAgent, browser, os, ip, country, subdivision1, subdivision2, city, device };
|
||||
}
|
||||
|
||||
export function hasBlockedIp(req: NextApiRequestCollect) {
|
||||
const ignoreIps = process.env.IGNORE_IP;
|
||||
|
||||
if (ignoreIps) {
|
||||
const ips = [];
|
||||
|
||||
if (ignoreIps) {
|
||||
ips.push(...ignoreIps.split(',').map(n => n.trim()));
|
||||
}
|
||||
|
||||
const clientIp = getIpAddress(req);
|
||||
|
||||
return ips.find(ip => {
|
||||
if (ip === clientIp) return true;
|
||||
|
||||
// CIDR notation
|
||||
if (ip.indexOf('/') > 0) {
|
||||
const addr = ipaddr.parse(clientIp);
|
||||
const range = ipaddr.parseCIDR(ip);
|
||||
|
||||
if (addr.kind() === range[0].kind() && addr.match(range)) return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,8 +61,8 @@ function getDateFormat(date: Date, format?: string): string {
|
|||
}
|
||||
|
||||
async function sendMessage(
|
||||
message: { [key: string]: string | number },
|
||||
topic: string,
|
||||
message: { [key: string]: string | number },
|
||||
): Promise<RecordMetadata[]> {
|
||||
await connect();
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ async function sendMessage(
|
|||
});
|
||||
}
|
||||
|
||||
async function sendMessages(messages: { [key: string]: string | number }[], topic: string) {
|
||||
async function sendMessages(topic: string, messages: { [key: string]: string | number }[]) {
|
||||
await connect();
|
||||
|
||||
await producer.send({
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ function getCastColumnQuery(field: string, type: string): string {
|
|||
}
|
||||
}
|
||||
|
||||
function getDateQuery(field: string, unit: string, timezone?: string): string {
|
||||
function getDateSQL(field: string, unit: string, timezone?: string): string {
|
||||
const db = getDatabaseType();
|
||||
|
||||
if (db === POSTGRESQL) {
|
||||
|
|
@ -81,7 +81,19 @@ function getDateQuery(field: string, unit: string, timezone?: string): string {
|
|||
}
|
||||
}
|
||||
|
||||
function getTimestampDiffQuery(field1: string, field2: string): string {
|
||||
export function getTimestampSQL(field: string) {
|
||||
const db = getDatabaseType();
|
||||
|
||||
if (db === POSTGRESQL) {
|
||||
return `floor(extract(epoch from ${field}))`;
|
||||
}
|
||||
|
||||
if (db === MYSQL) {
|
||||
return `UNIX_TIMESTAMP(${field})`;
|
||||
}
|
||||
}
|
||||
|
||||
function getTimestampDiffSQL(field1: string, field2: string): string {
|
||||
const db = getDatabaseType();
|
||||
|
||||
if (db === POSTGRESQL) {
|
||||
|
|
@ -93,7 +105,7 @@ function getTimestampDiffQuery(field1: string, field2: string): string {
|
|||
}
|
||||
}
|
||||
|
||||
function getSearchQuery(column: string): string {
|
||||
function getSearchSQL(column: string): string {
|
||||
const db = getDatabaseType();
|
||||
const like = db === POSTGRESQL ? 'ilike' : 'like';
|
||||
|
||||
|
|
@ -137,6 +149,20 @@ function getFilterQuery(filters: QueryFilters = {}, options: QueryOptions = {}):
|
|||
return query.join('\n');
|
||||
}
|
||||
|
||||
function getDateQuery(filters: QueryFilters = {}) {
|
||||
const { startDate, endDate } = filters;
|
||||
|
||||
if (startDate) {
|
||||
if (endDate) {
|
||||
return `and website_event.created_at between {{startDate}} and {{endDate}}`;
|
||||
} else {
|
||||
return `and website_event.created_at >= {{startDate}}`;
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
function getFilterParams(filters: QueryFilters = {}) {
|
||||
return filtersToArray(filters).reduce((obj, { name, operator, value }) => {
|
||||
obj[name] = [OPERATORS.contains, OPERATORS.doesNotContain].includes(operator)
|
||||
|
|
@ -161,6 +187,7 @@ async function parseFilters(
|
|||
? `inner join session on website_event.session_id = session.session_id`
|
||||
: '',
|
||||
filterQuery: getFilterQuery(filters, options),
|
||||
dateQuery: getDateQuery(filters),
|
||||
params: {
|
||||
...getFilterParams(filters),
|
||||
websiteId,
|
||||
|
|
@ -191,8 +218,8 @@ async function rawQuery(sql: string, data: object): Promise<any> {
|
|||
return prisma.rawQuery(query, params);
|
||||
}
|
||||
|
||||
async function pagedQuery<T>(model: string, criteria: T, filters: PageParams) {
|
||||
const { page = 1, pageSize, orderBy, sortDescending = false } = filters || {};
|
||||
async function pagedQuery<T>(model: string, criteria: T, pageParams: PageParams) {
|
||||
const { page = 1, pageSize, orderBy, sortDescending = false } = pageParams || {};
|
||||
const size = +pageSize || DEFAULT_PAGE_SIZE;
|
||||
|
||||
const data = await prisma.client[model].findMany({
|
||||
|
|
@ -256,11 +283,11 @@ export default {
|
|||
getAddIntervalQuery,
|
||||
getCastColumnQuery,
|
||||
getDayDiffQuery,
|
||||
getDateQuery,
|
||||
getDateSQL,
|
||||
getFilterQuery,
|
||||
getSearchParameters,
|
||||
getTimestampDiffQuery,
|
||||
getSearchQuery,
|
||||
getTimestampDiffSQL,
|
||||
getSearchSQL,
|
||||
getQueryMode,
|
||||
pagedQuery,
|
||||
parseFilters,
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
import { ok } from 'next-basics';
|
||||
import { CURRENT_VERSION, TELEMETRY_PIXEL } from 'lib/constants';
|
||||
import { NextApiRequest, NextApiResponse } from 'next';
|
||||
|
||||
export default function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
res.setHeader('content-type', 'text/javascript');
|
||||
|
||||
if (process.env.DISABLE_TELEMETRY || process.env.PRIVATE_MODE) {
|
||||
return res.send('/* telemetry disabled */');
|
||||
}
|
||||
|
||||
const script = `
|
||||
(()=>{const i=document.createElement('img');
|
||||
i.setAttribute('src','${TELEMETRY_PIXEL}?v=${CURRENT_VERSION}');
|
||||
i.setAttribute('style','width:0;height:0;position:absolute;pointer-events:none;');
|
||||
document.body.appendChild(i);})();
|
||||
`;
|
||||
|
||||
return res.send(script.replace(/\s\s+/g, ''));
|
||||
}
|
||||
|
||||
return ok(res);
|
||||
}
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
import ipaddr from 'ipaddr.js';
|
||||
import { isbot } from 'isbot';
|
||||
import { NextApiRequest, NextApiResponse } from 'next';
|
||||
import {
|
||||
|
|
@ -12,7 +11,7 @@ import {
|
|||
} from 'next-basics';
|
||||
import { COLLECTION_TYPE, HOSTNAME_REGEX, IP_REGEX } from 'lib/constants';
|
||||
import { secret, visitSalt, uuid } from 'lib/crypto';
|
||||
import { getIpAddress } from 'lib/detect';
|
||||
import { hasBlockedIp } from 'lib/detect';
|
||||
import { useCors, useSession, useValidate } from 'lib/middleware';
|
||||
import { CollectionType, YupRequest } from 'lib/types';
|
||||
import { saveEvent, saveSessionData } from 'queries';
|
||||
|
|
@ -122,7 +121,7 @@ export default async (req: NextApiRequestCollect, res: NextApiResponse) => {
|
|||
urlPath = '/';
|
||||
}
|
||||
|
||||
if (referrerPath?.startsWith('http')) {
|
||||
if (/^[\w-]+:\/\/\w+/.test(referrerPath)) {
|
||||
const refUrl = new URL(referrer);
|
||||
referrerPath = refUrl.pathname;
|
||||
referrerQuery = refUrl.search.substring(1);
|
||||
|
|
@ -166,31 +165,3 @@ export default async (req: NextApiRequestCollect, res: NextApiResponse) => {
|
|||
|
||||
return methodNotAllowed(res);
|
||||
};
|
||||
|
||||
function hasBlockedIp(req: NextApiRequestCollect) {
|
||||
const ignoreIps = process.env.IGNORE_IP;
|
||||
|
||||
if (ignoreIps) {
|
||||
const ips = [];
|
||||
|
||||
if (ignoreIps) {
|
||||
ips.push(...ignoreIps.split(',').map(n => n.trim()));
|
||||
}
|
||||
|
||||
const clientIp = getIpAddress(req);
|
||||
|
||||
return ips.find(ip => {
|
||||
if (ip === clientIp) return true;
|
||||
|
||||
// CIDR notation
|
||||
if (ip.indexOf('/') > 0) {
|
||||
const addr = ipaddr.parse(clientIp);
|
||||
const range = ipaddr.parseCIDR(ip);
|
||||
|
||||
if (addr.kind() === range[0].kind() && addr.match(range)) return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
42
src/pages/api/websites/[websiteId]/sessions.ts
Normal file
42
src/pages/api/websites/[websiteId]/sessions.ts
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import * as yup from 'yup';
|
||||
import { canViewWebsite } from 'lib/auth';
|
||||
import { useAuth, useCors, useValidate } from 'lib/middleware';
|
||||
import { NextApiRequestQueryBody, PageParams } from 'lib/types';
|
||||
import { NextApiResponse } from 'next';
|
||||
import { methodNotAllowed, ok, unauthorized } from 'next-basics';
|
||||
import { pageInfo } from 'lib/schema';
|
||||
import { getSessions } from 'queries';
|
||||
|
||||
export interface ReportsRequestQuery extends PageParams {
|
||||
websiteId: string;
|
||||
}
|
||||
|
||||
const schema = {
|
||||
GET: yup.object().shape({
|
||||
websiteId: yup.string().uuid().required(),
|
||||
...pageInfo,
|
||||
}),
|
||||
};
|
||||
|
||||
export default async (
|
||||
req: NextApiRequestQueryBody<ReportsRequestQuery, any>,
|
||||
res: NextApiResponse,
|
||||
) => {
|
||||
await useCors(req, res);
|
||||
await useAuth(req, res);
|
||||
await useValidate(schema, req, res);
|
||||
|
||||
const { websiteId } = req.query;
|
||||
|
||||
if (req.method === 'GET') {
|
||||
if (!(await canViewWebsite(req.auth, websiteId))) {
|
||||
return unauthorized(res);
|
||||
}
|
||||
|
||||
const data = await getSessions(websiteId, {}, req.query);
|
||||
|
||||
return ok(res, data);
|
||||
}
|
||||
|
||||
return methodNotAllowed(res);
|
||||
};
|
||||
|
|
@ -3,6 +3,7 @@ import { DATA_TYPE } from 'lib/constants';
|
|||
import { uuid } from 'lib/crypto';
|
||||
import { CLICKHOUSE, PRISMA, runQuery } from 'lib/db';
|
||||
import { flattenJSON, getStringValue } from 'lib/data';
|
||||
import clickhouse from 'lib/clickhouse';
|
||||
import kafka from 'lib/kafka';
|
||||
import prisma from 'lib/prisma';
|
||||
import { DynamicData } from 'lib/types';
|
||||
|
|
@ -59,6 +60,7 @@ async function clickhouseQuery(data: {
|
|||
}) {
|
||||
const { websiteId, sessionId, eventId, urlPath, eventName, eventData, createdAt } = data;
|
||||
|
||||
const { insert } = clickhouse;
|
||||
const { getDateFormat, sendMessages } = kafka;
|
||||
|
||||
const jsonKeys = flattenJSON(eventData);
|
||||
|
|
@ -79,7 +81,11 @@ async function clickhouseQuery(data: {
|
|||
};
|
||||
});
|
||||
|
||||
await sendMessages(messages, 'event_data');
|
||||
if (kafka.enabled) {
|
||||
await sendMessages('event_data', messages);
|
||||
} else {
|
||||
await insert('event_data', messages);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ export async function getEventMetrics(
|
|||
|
||||
async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
||||
const { timezone = 'utc', unit = 'day' } = filters;
|
||||
const { rawQuery, getDateQuery, parseFilters } = prisma;
|
||||
const { rawQuery, getDateSQL, parseFilters } = prisma;
|
||||
const { filterQuery, joinSession, params } = await parseFilters(websiteId, {
|
||||
...filters,
|
||||
eventType: EVENT_TYPE.customEvent,
|
||||
|
|
@ -25,7 +25,7 @@ async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
|||
`
|
||||
select
|
||||
event_name x,
|
||||
${getDateQuery('website_event.created_at', unit, timezone)} t,
|
||||
${getDateSQL('website_event.created_at', unit, timezone)} t,
|
||||
count(*) y
|
||||
from website_event
|
||||
${joinSession}
|
||||
|
|
@ -45,7 +45,7 @@ async function clickhouseQuery(
|
|||
filters: QueryFilters,
|
||||
): Promise<{ x: string; t: string; y: number }[]> {
|
||||
const { timezone = 'UTC', unit = 'day' } = filters;
|
||||
const { rawQuery, getDateQuery, parseFilters } = clickhouse;
|
||||
const { rawQuery, getDateSQL, parseFilters } = clickhouse;
|
||||
const { filterQuery, params } = await parseFilters(websiteId, {
|
||||
...filters,
|
||||
eventType: EVENT_TYPE.customEvent,
|
||||
|
|
@ -55,7 +55,7 @@ async function clickhouseQuery(
|
|||
`
|
||||
select
|
||||
event_name x,
|
||||
${getDateQuery('created_at', unit, timezone)} t,
|
||||
${getDateSQL('created_at', unit, timezone)} t,
|
||||
count(*) y
|
||||
from website_event
|
||||
where website_id = {websiteId:UUID}
|
||||
|
|
|
|||
|
|
@ -1,45 +1,33 @@
|
|||
import clickhouse from 'lib/clickhouse';
|
||||
import { CLICKHOUSE, PRISMA, runQuery } from 'lib/db';
|
||||
import prisma from 'lib/prisma';
|
||||
import { QueryFilters } from 'lib/types';
|
||||
import { PageParams, QueryFilters } from 'lib/types';
|
||||
|
||||
export function getEvents(...args: [websiteId: string, filters: QueryFilters]) {
|
||||
export function getEvents(
|
||||
...args: [websiteId: string, filters: QueryFilters, pageParams?: PageParams]
|
||||
) {
|
||||
return runQuery({
|
||||
[PRISMA]: () => relationalQuery(...args),
|
||||
[CLICKHOUSE]: () => clickhouseQuery(...args),
|
||||
});
|
||||
}
|
||||
|
||||
function relationalQuery(websiteId: string, filters: QueryFilters) {
|
||||
const { startDate } = filters;
|
||||
async function relationalQuery(websiteId: string, filters: QueryFilters, pageParams?: PageParams) {
|
||||
const { pagedQuery } = prisma;
|
||||
|
||||
return prisma.client.websiteEvent
|
||||
.findMany({
|
||||
where: {
|
||||
websiteId,
|
||||
createdAt: {
|
||||
gte: startDate,
|
||||
},
|
||||
},
|
||||
orderBy: {
|
||||
createdAt: 'desc',
|
||||
},
|
||||
})
|
||||
.then(a => {
|
||||
return Object.values(a).map(a => {
|
||||
return {
|
||||
...a,
|
||||
timestamp: new Date(a.createdAt).getTime() / 1000,
|
||||
};
|
||||
});
|
||||
});
|
||||
const where = {
|
||||
...filters,
|
||||
id: websiteId,
|
||||
};
|
||||
|
||||
return pagedQuery('website_event', { where }, pageParams);
|
||||
}
|
||||
|
||||
function clickhouseQuery(websiteId: string, filters: QueryFilters) {
|
||||
const { rawQuery } = clickhouse;
|
||||
const { startDate } = filters;
|
||||
async function clickhouseQuery(websiteId: string, filters: QueryFilters, pageParams?: PageParams) {
|
||||
const { pagedQuery, parseFilters } = clickhouse;
|
||||
const { params, dateQuery, filterQuery } = await parseFilters(websiteId, filters);
|
||||
|
||||
return rawQuery(
|
||||
return pagedQuery(
|
||||
`
|
||||
select
|
||||
event_id as id,
|
||||
|
|
@ -48,16 +36,20 @@ function clickhouseQuery(websiteId: string, filters: QueryFilters) {
|
|||
created_at as createdAt,
|
||||
toUnixTimestamp(created_at) as timestamp,
|
||||
url_path as urlPath,
|
||||
url_query as urlQuery,
|
||||
referrer_path as referrerPath,
|
||||
referrer_query as referrerQuery,
|
||||
referrer_domain as referrerDomain,
|
||||
page_title as pageTitle,
|
||||
event_type as eventType,
|
||||
event_name as eventName
|
||||
from website_event
|
||||
where website_id = {websiteId:UUID}
|
||||
and created_at >= {startDate:DateTime64}
|
||||
${dateQuery}
|
||||
${filterQuery}
|
||||
order by created_at desc
|
||||
`,
|
||||
{
|
||||
websiteId,
|
||||
startDate,
|
||||
},
|
||||
params,
|
||||
pageParams,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { EVENT_NAME_LENGTH, URL_LENGTH, EVENT_TYPE, PAGE_TITLE_LENGTH } from 'lib/constants';
|
||||
import { CLICKHOUSE, PRISMA, runQuery } from 'lib/db';
|
||||
import clickhouse from 'lib/clickhouse';
|
||||
import kafka from 'lib/kafka';
|
||||
import prisma from 'lib/prisma';
|
||||
import { uuid } from 'lib/crypto';
|
||||
|
|
@ -134,6 +135,7 @@ async function clickhouseQuery(data: {
|
|||
city,
|
||||
...args
|
||||
} = data;
|
||||
const { insert } = clickhouse;
|
||||
const { getDateFormat, sendMessage } = kafka;
|
||||
const eventId = uuid();
|
||||
const createdAt = getDateFormat(new Date());
|
||||
|
|
@ -164,7 +166,11 @@ async function clickhouseQuery(data: {
|
|||
created_at: createdAt,
|
||||
};
|
||||
|
||||
await sendMessage(message, 'event');
|
||||
if (kafka.enabled) {
|
||||
await sendMessage('event', message);
|
||||
} else {
|
||||
await insert('website_event', [message]);
|
||||
}
|
||||
|
||||
if (eventData) {
|
||||
await saveEventData({
|
||||
|
|
|
|||
|
|
@ -19,15 +19,15 @@ export async function getRealtimeData(
|
|||
const { startDate, timezone } = criteria;
|
||||
const filters = { startDate, endDate: new Date(), unit: 'minute', timezone };
|
||||
const [events, sessions, pageviews, sessionviews] = await Promise.all([
|
||||
getEvents(websiteId, { startDate }),
|
||||
getSessions(websiteId, { startDate }),
|
||||
getEvents(websiteId, { startDate }, { pageSize: 10000 }),
|
||||
getSessions(websiteId, { startDate }, { pageSize: 10000 }),
|
||||
getPageviewStats(websiteId, filters),
|
||||
getSessionStats(websiteId, filters),
|
||||
]);
|
||||
|
||||
const uniques = new Set();
|
||||
|
||||
const sessionStats = sessions.reduce(
|
||||
const sessionStats = sessions.data.reduce(
|
||||
(obj: { visitors: any; countries: any }, session: { id: any; country: any }) => {
|
||||
const { countries, visitors } = obj;
|
||||
const { id, country } = session;
|
||||
|
|
@ -49,7 +49,7 @@ export async function getRealtimeData(
|
|||
},
|
||||
);
|
||||
|
||||
const eventStats = events.reduce(
|
||||
const eventStats = events.data.reduce(
|
||||
(
|
||||
obj: { urls: any; referrers: any; events: any },
|
||||
event: { urlPath: any; referrerDomain: any },
|
||||
|
|
@ -81,9 +81,9 @@ export async function getRealtimeData(
|
|||
visitors: sessionviews,
|
||||
},
|
||||
totals: {
|
||||
views: events.filter(e => !e.eventName).length,
|
||||
views: events.data.filter(e => !e.eventName).length,
|
||||
visitors: uniques.size,
|
||||
events: events.filter(e => e.eventName).length,
|
||||
events: events.data.filter(e => e.eventName).length,
|
||||
countries: Object.keys(sessionStats.countries).length,
|
||||
},
|
||||
timestamp: Date.now(),
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@ async function relationalQuery(
|
|||
endDate: Date,
|
||||
search: string,
|
||||
) {
|
||||
const { rawQuery, getSearchQuery } = prisma;
|
||||
const { rawQuery, getSearchSQL } = prisma;
|
||||
let searchQuery = '';
|
||||
|
||||
if (search) {
|
||||
searchQuery = getSearchQuery(column);
|
||||
searchQuery = getSearchSQL(column);
|
||||
}
|
||||
|
||||
return rawQuery(
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ async function relationalQuery(
|
|||
): Promise<
|
||||
{ pageviews: number; visitors: number; visits: number; bounces: number; totaltime: number }[]
|
||||
> {
|
||||
const { getTimestampDiffQuery, parseFilters, rawQuery } = prisma;
|
||||
const { getTimestampDiffSQL, parseFilters, rawQuery } = prisma;
|
||||
const { filterQuery, joinSession, params } = await parseFilters(websiteId, {
|
||||
...filters,
|
||||
eventType: EVENT_TYPE.pageView,
|
||||
|
|
@ -34,7 +34,7 @@ async function relationalQuery(
|
|||
count(distinct t.session_id) as "visitors",
|
||||
count(distinct t.visit_id) as "visits",
|
||||
sum(case when t.c = 1 then 1 else 0 end) as "bounces",
|
||||
sum(${getTimestampDiffQuery('t.min_time', 't.max_time')}) as "totaltime"
|
||||
sum(${getTimestampDiffSQL('t.min_time', 't.max_time')}) as "totaltime"
|
||||
from (
|
||||
select
|
||||
website_event.session_id,
|
||||
|
|
@ -71,8 +71,8 @@ async function clickhouseQuery(
|
|||
`
|
||||
select
|
||||
sum(t.c) as "pageviews",
|
||||
count(distinct t.session_id) as "visitors",
|
||||
count(distinct t.visit_id) as "visits",
|
||||
uniq(t.session_id) as "visitors",
|
||||
uniq(t.visit_id) as "visits",
|
||||
sum(if(t.c = 1, 1, 0)) as "bounces",
|
||||
sum(max_time-min_time) as "totaltime"
|
||||
from (
|
||||
|
|
|
|||
|
|
@ -42,15 +42,18 @@ async function relationalQuery(
|
|||
const aggregrate = type === 'entry' ? 'min' : 'max';
|
||||
|
||||
entryExitQuery = `
|
||||
JOIN (select visit_id,
|
||||
${aggregrate}(created_at) target_created_at
|
||||
from website_event
|
||||
where website_event.website_id = {{websiteId::uuid}}
|
||||
and website_event.created_at between {{startDate}} and {{endDate}}
|
||||
and event_type = {{eventType}}
|
||||
group by visit_id) x
|
||||
ON x.visit_id = website_event.visit_id
|
||||
and x.target_created_at = website_event.created_at`;
|
||||
join (
|
||||
select visit_id,
|
||||
${aggregrate}(created_at) target_created_at
|
||||
from website_event
|
||||
where website_event.website_id = {{websiteId::uuid}}
|
||||
and website_event.created_at between {{startDate}} and {{endDate}}
|
||||
and event_type = {{eventType}}
|
||||
group by visit_id
|
||||
) x
|
||||
on x.visit_id = website_event.visit_id
|
||||
and x.target_created_at = website_event.created_at
|
||||
`;
|
||||
}
|
||||
|
||||
return rawQuery(
|
||||
|
|
@ -97,15 +100,18 @@ async function clickhouseQuery(
|
|||
const aggregrate = type === 'entry' ? 'min' : 'max';
|
||||
|
||||
entryExitQuery = `
|
||||
JOIN (select visit_id,
|
||||
${aggregrate}(created_at) target_created_at
|
||||
from website_event
|
||||
where website_id = {websiteId:UUID}
|
||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||
and event_type = {eventType:UInt32}
|
||||
group by visit_id) x
|
||||
ON x.visit_id = website_event.visit_id
|
||||
and x.target_created_at = website_event.created_at`;
|
||||
join (
|
||||
select visit_id,
|
||||
${aggregrate}(created_at) target_created_at
|
||||
from website_event
|
||||
where website_id = {websiteId:UUID}
|
||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||
and event_type = {eventType:UInt32}
|
||||
group by visit_id
|
||||
) x
|
||||
on x.visit_id = website_event.visit_id
|
||||
and x.target_created_at = website_event.created_at
|
||||
`;
|
||||
}
|
||||
|
||||
return rawQuery(
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ export async function getPageviewStats(...args: [websiteId: string, filters: Que
|
|||
|
||||
async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
||||
const { timezone = 'utc', unit = 'day' } = filters;
|
||||
const { getDateQuery, parseFilters, rawQuery } = prisma;
|
||||
const { getDateSQL, parseFilters, rawQuery } = prisma;
|
||||
const { filterQuery, joinSession, params } = await parseFilters(websiteId, {
|
||||
...filters,
|
||||
eventType: EVENT_TYPE.pageView,
|
||||
|
|
@ -22,7 +22,7 @@ async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
|||
return rawQuery(
|
||||
`
|
||||
select
|
||||
${getDateQuery('website_event.created_at', unit, timezone)} x,
|
||||
${getDateSQL('website_event.created_at', unit, timezone)} x,
|
||||
count(*) y
|
||||
from website_event
|
||||
${joinSession}
|
||||
|
|
@ -41,7 +41,7 @@ async function clickhouseQuery(
|
|||
filters: QueryFilters,
|
||||
): Promise<{ x: string; y: number }[]> {
|
||||
const { timezone = 'UTC', unit = 'day' } = filters;
|
||||
const { parseFilters, rawQuery, getDateStringQuery, getDateQuery } = clickhouse;
|
||||
const { parseFilters, rawQuery, getDateStringSQL, getDateSQL } = clickhouse;
|
||||
const { filterQuery, params } = await parseFilters(websiteId, {
|
||||
...filters,
|
||||
eventType: EVENT_TYPE.pageView,
|
||||
|
|
@ -50,11 +50,11 @@ async function clickhouseQuery(
|
|||
return rawQuery(
|
||||
`
|
||||
select
|
||||
${getDateStringQuery('g.t', unit)} as x,
|
||||
${getDateStringSQL('g.t', unit)} as x,
|
||||
g.y as y
|
||||
from (
|
||||
select
|
||||
${getDateQuery('created_at', unit, timezone)} as t,
|
||||
${getDateSQL('created_at', unit, timezone)} as t,
|
||||
count(*) as y
|
||||
from website_event
|
||||
where website_id = {websiteId:UUID}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ async function relationalQuery(
|
|||
y: number;
|
||||
}[]
|
||||
> {
|
||||
const { getTimestampDiffQuery, parseFilters, rawQuery } = prisma;
|
||||
const { getTimestampDiffSQL, parseFilters, rawQuery } = prisma;
|
||||
const { filterQuery, joinSession, params } = await parseFilters(
|
||||
websiteId,
|
||||
{
|
||||
|
|
@ -42,7 +42,7 @@ async function relationalQuery(
|
|||
count(distinct t.session_id) as "visitors",
|
||||
count(distinct t.visit_id) as "visits",
|
||||
sum(case when t.c = 1 then 1 else 0 end) as "bounces",
|
||||
sum(${getTimestampDiffQuery('t.min_time', 't.max_time')}) as "totaltime",
|
||||
sum(${getTimestampDiffSQL('t.min_time', 't.max_time')}) as "totaltime",
|
||||
${parseFieldsByName(fields)}
|
||||
from (
|
||||
select
|
||||
|
|
|
|||
|
|
@ -35,14 +35,14 @@ async function relationalQuery(
|
|||
}[]
|
||||
> {
|
||||
const { startDate, endDate, timezone = 'UTC' } = filters;
|
||||
const { getDateQuery, getDayDiffQuery, getCastColumnQuery, rawQuery } = prisma;
|
||||
const { getDateSQL, getDayDiffQuery, getCastColumnQuery, rawQuery } = prisma;
|
||||
const unit = 'day';
|
||||
|
||||
return rawQuery(
|
||||
`
|
||||
WITH cohort_items AS (
|
||||
select session_id,
|
||||
${getDateQuery('created_at', unit, timezone)} as cohort_date
|
||||
${getDateSQL('created_at', unit, timezone)} as cohort_date
|
||||
from session
|
||||
where website_id = {{websiteId::uuid}}
|
||||
and created_at between {{startDate}} and {{endDate}}
|
||||
|
|
@ -50,10 +50,7 @@ async function relationalQuery(
|
|||
user_activities AS (
|
||||
select distinct
|
||||
w.session_id,
|
||||
${getDayDiffQuery(
|
||||
getDateQuery('created_at', unit, timezone),
|
||||
'c.cohort_date',
|
||||
)} as day_number
|
||||
${getDayDiffQuery(getDateSQL('created_at', unit, timezone), 'c.cohort_date')} as day_number
|
||||
from website_event w
|
||||
join cohort_items c
|
||||
on w.session_id = c.session_id
|
||||
|
|
@ -115,14 +112,14 @@ async function clickhouseQuery(
|
|||
}[]
|
||||
> {
|
||||
const { startDate, endDate, timezone = 'UTC' } = filters;
|
||||
const { getDateQuery, getDateStringQuery, rawQuery } = clickhouse;
|
||||
const { getDateSQL, getDateStringSQL, rawQuery } = clickhouse;
|
||||
const unit = 'day';
|
||||
|
||||
return rawQuery(
|
||||
`
|
||||
WITH cohort_items AS (
|
||||
select
|
||||
min(${getDateQuery('created_at', unit, timezone)}) as cohort_date,
|
||||
min(${getDateSQL('created_at', unit, timezone)}) as cohort_date,
|
||||
session_id
|
||||
from website_event
|
||||
where website_id = {websiteId:UUID}
|
||||
|
|
@ -132,7 +129,7 @@ async function clickhouseQuery(
|
|||
user_activities AS (
|
||||
select distinct
|
||||
w.session_id,
|
||||
(${getDateQuery('created_at', unit, timezone)} - c.cohort_date) / 86400 as day_number
|
||||
(${getDateSQL('created_at', unit, timezone)} - c.cohort_date) / 86400 as day_number
|
||||
from website_event w
|
||||
join cohort_items c
|
||||
on w.session_id = c.session_id
|
||||
|
|
@ -157,7 +154,7 @@ async function clickhouseQuery(
|
|||
group by 1, 2
|
||||
)
|
||||
select
|
||||
${getDateStringQuery('c.cohort_date', unit)} as date,
|
||||
${getDateStringSQL('c.cohort_date', unit)} as date,
|
||||
c.day_number as day,
|
||||
s.visitors as visitors,
|
||||
c.visitors returnVisitors,
|
||||
|
|
|
|||
|
|
@ -46,12 +46,12 @@ async function relationalQuery(
|
|||
timezone = 'UTC',
|
||||
unit = 'day',
|
||||
} = criteria;
|
||||
const { getDateQuery, rawQuery } = prisma;
|
||||
const { getDateSQL, rawQuery } = prisma;
|
||||
|
||||
const chartRes = await rawQuery(
|
||||
`
|
||||
select
|
||||
${getDateQuery('website_event.created_at', unit, timezone)} time,
|
||||
${getDateSQL('website_event.created_at', unit, timezone)} time,
|
||||
sum(case when data_key = {{revenueProperty}} then number_value else 0 end) sum,
|
||||
avg(case when data_key = {{revenueProperty}} then number_value else 0 end) avg,
|
||||
count(case when data_key = {{revenueProperty}} then 1 else 0 end) count,
|
||||
|
|
@ -110,7 +110,7 @@ async function clickhouseQuery(
|
|||
timezone = 'UTC',
|
||||
unit = 'day',
|
||||
} = criteria;
|
||||
const { getDateStringQuery, getDateQuery, rawQuery } = clickhouse;
|
||||
const { getDateStringSQL, getDateSQL, rawQuery } = clickhouse;
|
||||
|
||||
const chartRes = await rawQuery<{
|
||||
time: string;
|
||||
|
|
@ -121,14 +121,14 @@ async function clickhouseQuery(
|
|||
}>(
|
||||
`
|
||||
select
|
||||
${getDateStringQuery('g.time', unit)} as time,
|
||||
${getDateStringSQL('g.time', unit)} as time,
|
||||
g.sum as sum,
|
||||
g.avg as avg,
|
||||
g.count as count,
|
||||
g.uniqueCount as uniqueCount
|
||||
from (
|
||||
select
|
||||
${getDateQuery('created_at', unit, timezone)} as time,
|
||||
${getDateSQL('created_at', unit, timezone)} as time,
|
||||
sumIf(number_value, data_key = {revenueProperty:String}) as sum,
|
||||
avgIf(number_value, data_key = {revenueProperty:String}) as avg,
|
||||
countIf(data_key = {revenueProperty:String}) as count,
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ async function clickhouseQuery(
|
|||
`
|
||||
select
|
||||
${column} x,
|
||||
count(distinct session_id) y
|
||||
uniq(session_id) y
|
||||
${includeCountry ? ', country' : ''}
|
||||
from website_event
|
||||
where website_id = {websiteId:UUID}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ export async function getSessionStats(...args: [websiteId: string, filters: Quer
|
|||
|
||||
async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
||||
const { timezone = 'utc', unit = 'day' } = filters;
|
||||
const { getDateQuery, parseFilters, rawQuery } = prisma;
|
||||
const { getDateSQL, parseFilters, rawQuery } = prisma;
|
||||
const { filterQuery, joinSession, params } = await parseFilters(websiteId, {
|
||||
...filters,
|
||||
eventType: EVENT_TYPE.pageView,
|
||||
|
|
@ -22,7 +22,7 @@ async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
|||
return rawQuery(
|
||||
`
|
||||
select
|
||||
${getDateQuery('website_event.created_at', unit, timezone)} x,
|
||||
${getDateSQL('website_event.created_at', unit, timezone)} x,
|
||||
count(distinct website_event.session_id) y
|
||||
from website_event
|
||||
${joinSession}
|
||||
|
|
@ -41,7 +41,7 @@ async function clickhouseQuery(
|
|||
filters: QueryFilters,
|
||||
): Promise<{ x: string; y: number }[]> {
|
||||
const { timezone = 'UTC', unit = 'day' } = filters;
|
||||
const { parseFilters, rawQuery, getDateStringQuery, getDateQuery } = clickhouse;
|
||||
const { parseFilters, rawQuery, getDateStringSQL, getDateSQL } = clickhouse;
|
||||
const { filterQuery, params } = await parseFilters(websiteId, {
|
||||
...filters,
|
||||
eventType: EVENT_TYPE.pageView,
|
||||
|
|
@ -50,11 +50,11 @@ async function clickhouseQuery(
|
|||
return rawQuery(
|
||||
`
|
||||
select
|
||||
${getDateStringQuery('g.t', unit)} as x,
|
||||
${getDateStringSQL('g.t', unit)} as x,
|
||||
g.y as y
|
||||
from (
|
||||
select
|
||||
${getDateQuery('created_at', unit, timezone)} as t,
|
||||
${getDateSQL('created_at', unit, timezone)} as t,
|
||||
count(distinct session_id) as y
|
||||
from website_event
|
||||
where website_id = {websiteId:UUID}
|
||||
|
|
|
|||
|
|
@ -1,45 +1,33 @@
|
|||
import prisma from 'lib/prisma';
|
||||
import clickhouse from 'lib/clickhouse';
|
||||
import { runQuery, PRISMA, CLICKHOUSE } from 'lib/db';
|
||||
import { QueryFilters } from 'lib/types';
|
||||
import { PageParams, QueryFilters } from 'lib/types';
|
||||
|
||||
export async function getSessions(...args: [websiteId: string, filters: QueryFilters]) {
|
||||
export async function getSessions(
|
||||
...args: [websiteId: string, filters?: QueryFilters, pageParams?: PageParams]
|
||||
) {
|
||||
return runQuery({
|
||||
[PRISMA]: () => relationalQuery(...args),
|
||||
[CLICKHOUSE]: () => clickhouseQuery(...args),
|
||||
});
|
||||
}
|
||||
|
||||
async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
||||
const { startDate } = filters;
|
||||
async function relationalQuery(websiteId: string, filters: QueryFilters, pageParams: PageParams) {
|
||||
const { pagedQuery } = prisma;
|
||||
|
||||
return prisma.client.session
|
||||
.findMany({
|
||||
where: {
|
||||
websiteId,
|
||||
createdAt: {
|
||||
gte: startDate,
|
||||
},
|
||||
},
|
||||
orderBy: {
|
||||
createdAt: 'desc',
|
||||
},
|
||||
})
|
||||
.then(a => {
|
||||
return Object.values(a).map(a => {
|
||||
return {
|
||||
...a,
|
||||
timestamp: new Date(a.createdAt).getTime() / 1000,
|
||||
};
|
||||
});
|
||||
});
|
||||
const where = {
|
||||
...filters,
|
||||
id: websiteId,
|
||||
};
|
||||
|
||||
return pagedQuery('session', { where }, pageParams);
|
||||
}
|
||||
|
||||
async function clickhouseQuery(websiteId: string, filters: QueryFilters) {
|
||||
const { rawQuery } = clickhouse;
|
||||
const { startDate } = filters;
|
||||
async function clickhouseQuery(websiteId: string, filters: QueryFilters, pageParams?: PageParams) {
|
||||
const { pagedQuery, parseFilters } = clickhouse;
|
||||
const { params, dateQuery, filterQuery } = await parseFilters(websiteId, filters);
|
||||
|
||||
return rawQuery(
|
||||
return pagedQuery(
|
||||
`
|
||||
select
|
||||
session_id as id,
|
||||
|
|
@ -58,12 +46,11 @@ async function clickhouseQuery(websiteId: string, filters: QueryFilters) {
|
|||
city
|
||||
from website_event
|
||||
where website_id = {websiteId:UUID}
|
||||
and created_at >= {startDate:DateTime64}
|
||||
${dateQuery}
|
||||
${filterQuery}
|
||||
order by created_at desc
|
||||
`,
|
||||
{
|
||||
websiteId,
|
||||
startDate,
|
||||
},
|
||||
params,
|
||||
pageParams,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import prisma from 'lib/prisma';
|
|||
import { DynamicData } from 'lib/types';
|
||||
import { CLICKHOUSE, PRISMA, runQuery } from 'lib/db';
|
||||
import kafka from 'lib/kafka';
|
||||
import clickhouse from 'lib/clickhouse';
|
||||
|
||||
export async function saveSessionData(data: {
|
||||
websiteId: string;
|
||||
|
|
@ -81,6 +82,7 @@ async function clickhouseQuery(data: {
|
|||
}) {
|
||||
const { websiteId, sessionId, sessionData, createdAt } = data;
|
||||
|
||||
const { insert } = clickhouse;
|
||||
const { getDateFormat, sendMessages } = kafka;
|
||||
|
||||
const jsonKeys = flattenJSON(sessionData);
|
||||
|
|
@ -98,7 +100,11 @@ async function clickhouseQuery(data: {
|
|||
};
|
||||
});
|
||||
|
||||
await sendMessages(messages, 'session_data');
|
||||
if (kafka.enabled) {
|
||||
await sendMessages('session_data', messages);
|
||||
} else {
|
||||
await insert('session_data', messages);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
export * from './admin/report';
|
||||
export * from './admin/team';
|
||||
export * from './admin/teamUser';
|
||||
export * from './admin/user';
|
||||
export * from './admin/website';
|
||||
export * from 'queries/prisma/report';
|
||||
export * from 'queries/prisma/team';
|
||||
export * from 'queries/prisma/teamUser';
|
||||
export * from 'queries/prisma/user';
|
||||
export * from 'queries/prisma/website';
|
||||
export * from './analytics/events/getEventMetrics';
|
||||
export * from './analytics/events/getEventUsage';
|
||||
export * from './analytics/events/getEvents';
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@ export async function getReport(reportId: string): Promise<Report> {
|
|||
|
||||
export async function getReports(
|
||||
criteria: ReportFindManyArgs,
|
||||
filters: PageParams = {},
|
||||
pageParams: PageParams = {},
|
||||
): Promise<PageResult<Report[]>> {
|
||||
const { query } = filters;
|
||||
const { query } = pageParams;
|
||||
|
||||
const where: Prisma.ReportWhereInput = {
|
||||
...criteria.where,
|
||||
|
|
@ -45,7 +45,7 @@ export async function getReports(
|
|||
]),
|
||||
};
|
||||
|
||||
return prisma.pagedQuery('report', { ...criteria, where }, filters);
|
||||
return prisma.pagedQuery('report', { ...criteria, where }, pageParams);
|
||||
}
|
||||
|
||||
export async function getUserReports(
|
||||
|
|
@ -49,9 +49,9 @@ export async function getUserByUsername(username: string, options: GetUserOption
|
|||
|
||||
export async function getUsers(
|
||||
criteria: UserFindManyArgs,
|
||||
filters?: PageParams,
|
||||
pageParams?: PageParams,
|
||||
): Promise<PageResult<User[]>> {
|
||||
const { query } = filters;
|
||||
const { query } = pageParams;
|
||||
|
||||
const where: Prisma.UserWhereInput = {
|
||||
...criteria.where,
|
||||
|
|
@ -68,7 +68,7 @@ export async function getUsers(
|
|||
{
|
||||
orderBy: 'createdAt',
|
||||
sortDescending: true,
|
||||
...filters,
|
||||
...pageParams,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
@ -27,9 +27,9 @@ export async function getSharedWebsite(shareId: string) {
|
|||
|
||||
export async function getWebsites(
|
||||
criteria: WebsiteFindManyArgs,
|
||||
filters: PageParams,
|
||||
pageParams: PageParams,
|
||||
): Promise<PageResult<Website[]>> {
|
||||
const { query } = filters;
|
||||
const { query } = pageParams;
|
||||
|
||||
const where: Prisma.WebsiteWhereInput = {
|
||||
...criteria.where,
|
||||
|
|
@ -42,7 +42,7 @@ export async function getWebsites(
|
|||
deletedAt: null,
|
||||
};
|
||||
|
||||
return prisma.pagedQuery('website', { ...criteria, where }, filters);
|
||||
return prisma.pagedQuery('website', { ...criteria, where }, pageParams);
|
||||
}
|
||||
|
||||
export async function getAllWebsites(userId: string) {
|
||||
Loading…
Add table
Add a link
Reference in a new issue