implement session replay filters
This commit is contained in:
1 parent
f3ce0e64ca
commit
c61c01e3bb
62 files changed
+264
-372
No files matched your search
@@ -286,8 +286,9 @@ function ClickHeatmapView({
|
||||
: '100%';
|
||||
const overlayPageW = snapshot?.pageW ?? viewport?.pageW ?? baseWidth;
|
||||
const overlayPageH = snapshot?.pageH ?? viewport?.pageH ?? baseHeight;
|
||||
const showSnapshot = renderWidth > 0 && showPage && hasSnapshot;
|
||||
const showOverlay = !showSnapshot || snapshotReady;
|
||||
const shouldRenderSnapshot = renderWidth > 0 && hasSnapshot;
|
||||
const showSnapshot = shouldRenderSnapshot && showPage;
|
||||
const showOverlay = !showPage || !shouldRenderSnapshot || snapshotReady;
|
||||
const totalClicks = visible.reduce((sum, point) => sum + point.count, 0);
|
||||
const showLoading = isLoading;
|
||||
|
||||
@@ -345,12 +346,14 @@ function ClickHeatmapView({
|
||||
<>
|
||||
<div className={styles.snapshotClip}>
|
||||
{showSnapshot && !snapshotReady && <CanvasLoading />}
|
||||
{showSnapshot && snapshot && (
|
||||
<SnapshotPreview
|
||||
websiteId={websiteId}
|
||||
snapshot={snapshot}
|
||||
onReady={handleSnapshotReady}
|
||||
/>
|
||||
{shouldRenderSnapshot && snapshot && (
|
||||
<div hidden={!showPage}>
|
||||
<SnapshotPreview
|
||||
websiteId={websiteId}
|
||||
snapshot={snapshot}
|
||||
onReady={handleSnapshotReady}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{showOverlay && (
|
||||
@@ -445,8 +448,9 @@ function ScrollHeatmapView({
|
||||
? `${renderWidth}px`
|
||||
: `min(100%, ${renderWidth}px)`
|
||||
: '100%';
|
||||
const showSnapshot = renderWidth > 0 && showPage && hasSnapshot;
|
||||
const showOverlay = !showSnapshot || snapshotReady;
|
||||
const shouldRenderSnapshot = renderWidth > 0 && hasSnapshot;
|
||||
const showSnapshot = shouldRenderSnapshot && showPage;
|
||||
const showOverlay = !showPage || !shouldRenderSnapshot || snapshotReady;
|
||||
const hasScrollData = Boolean(scroll && totalSessions > 0 && pageW && pageH && viewportW);
|
||||
const showLoading = isLoading;
|
||||
|
||||
@@ -520,12 +524,14 @@ function ScrollHeatmapView({
|
||||
) : (
|
||||
<div className={styles.canvasClip}>
|
||||
{showSnapshot && !snapshotReady && <CanvasLoading />}
|
||||
{showSnapshot && snapshot && (
|
||||
<SnapshotPreview
|
||||
websiteId={websiteId}
|
||||
snapshot={snapshot}
|
||||
onReady={handleSnapshotReady}
|
||||
/>
|
||||
{shouldRenderSnapshot && snapshot && (
|
||||
<div hidden={!showPage}>
|
||||
<SnapshotPreview
|
||||
websiteId={websiteId}
|
||||
snapshot={snapshot}
|
||||
onReady={handleSnapshotReady}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{showOverlay && (
|
||||
<div className={styles.overlay}>
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
'use client';
|
||||
|
||||
import { Button, Column, Label, Row, Text, TextField } from '@umami/react-zen';
|
||||
import { useState } from 'react';
|
||||
import { useMessages, useNavigation } from '@/components/hooks';
|
||||
import { ListFilter } from '@/components/icons';
|
||||
import { DialogButton } from '@/components/input/DialogButton';
|
||||
|
||||
const DEFAULT_MIN_DURATION = '5';
|
||||
|
||||
function getMinDurationValue(value: unknown) {
|
||||
if (value === '0') {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (typeof value !== 'string' || !/^\d+$/.test(value)) {
|
||||
return DEFAULT_MIN_DURATION;
|
||||
}
|
||||
|
||||
return Number(value) > 0 ? value : DEFAULT_MIN_DURATION;
|
||||
}
|
||||
|
||||
function ReplayFilterForm({
|
||||
minDuration,
|
||||
onClose,
|
||||
}: {
|
||||
minDuration: string;
|
||||
onClose?: () => void;
|
||||
}) {
|
||||
const { t, labels, messages } = useMessages();
|
||||
const { router, updateParams } = useNavigation();
|
||||
const [value, setValue] = useState(minDuration);
|
||||
|
||||
const handleChange = (nextValue: string) => {
|
||||
if (/^\d*$/.test(nextValue)) {
|
||||
setValue(nextValue);
|
||||
}
|
||||
};
|
||||
|
||||
const handleReset = () => {
|
||||
setValue(DEFAULT_MIN_DURATION);
|
||||
};
|
||||
|
||||
const handleApply = () => {
|
||||
const nextValue = value ? Number(value) : 0;
|
||||
|
||||
router.push(
|
||||
updateParams({
|
||||
minDuration: nextValue > 0 ? nextValue : 0,
|
||||
page: 1,
|
||||
}),
|
||||
);
|
||||
|
||||
onClose?.();
|
||||
};
|
||||
|
||||
return (
|
||||
<Column width="320px" gap="4">
|
||||
<Column gap="2">
|
||||
<Label>{t(labels.minDurationSeconds)}</Label>
|
||||
<Text color="muted">{t(messages.replayMinDurationDescription)}</Text>
|
||||
<TextField
|
||||
value={value}
|
||||
onChange={handleChange}
|
||||
autoFocus
|
||||
autoComplete="off"
|
||||
inputMode="numeric"
|
||||
placeholder="10"
|
||||
/>
|
||||
</Column>
|
||||
<Row alignItems="center" justifyContent="space-between" gap>
|
||||
<Button onPress={handleReset}>{t(labels.reset)}</Button>
|
||||
<Row alignItems="center" justifyContent="flex-end" gap>
|
||||
<Button onPress={onClose}>{t(labels.cancel)}</Button>
|
||||
<Button variant="primary" onPress={handleApply}>
|
||||
{t(labels.apply)}
|
||||
</Button>
|
||||
</Row>
|
||||
</Row>
|
||||
</Column>
|
||||
);
|
||||
}
|
||||
|
||||
export function ReplayFilterButton() {
|
||||
const { t, labels } = useMessages();
|
||||
const { query } = useNavigation();
|
||||
const minDuration = getMinDurationValue(query.minDuration);
|
||||
const title = `${t(labels.replay)} ${t(labels.filter)}`;
|
||||
const label = minDuration ? `${title} (${minDuration}s+)` : title;
|
||||
|
||||
return (
|
||||
<DialogButton icon={<ListFilter />} label={label} title={title} variant="outline">
|
||||
{({ close }) => <ReplayFilterForm minDuration={minDuration} onClose={close} />}
|
||||
</DialogButton>
|
||||
);
|
||||
}
|
||||
@@ -1,12 +1,25 @@
|
||||
import { DataGrid } from '@/components/common/DataGrid';
|
||||
import { useReplaysQuery } from '@/components/hooks';
|
||||
import { useNavigation, useReplaysQuery } from '@/components/hooks';
|
||||
import { ReplayFilterButton } from './ReplayFilterButton';
|
||||
import { ReplaysTable } from './ReplaysTable';
|
||||
|
||||
const DEFAULT_MIN_DURATION = 5;
|
||||
|
||||
export function ReplaysDataTable({ websiteId }: { websiteId: string }) {
|
||||
const queryResult = useReplaysQuery(websiteId);
|
||||
const { query } = useNavigation();
|
||||
const minDuration =
|
||||
typeof query.minDuration === 'string' && /^\d+$/.test(query.minDuration)
|
||||
? query.minDuration
|
||||
: String(DEFAULT_MIN_DURATION);
|
||||
const queryResult = useReplaysQuery(websiteId, { minDuration });
|
||||
|
||||
return (
|
||||
<DataGrid query={queryResult} allowPaging allowSearch>
|
||||
<DataGrid
|
||||
query={queryResult}
|
||||
allowPaging
|
||||
allowSearch
|
||||
renderActions={() => <ReplayFilterButton />}
|
||||
>
|
||||
{({ data }) => {
|
||||
return <ReplaysTable data={data} />;
|
||||
}}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { getQueryFilters, parseRequest } from '@/lib/request';
|
||||
import { json, unauthorized } from '@/lib/response';
|
||||
import { filterParams, pagingParams, searchParams, withDateRange } from '@/lib/schema';
|
||||
import { filterParams, pagingParams, replayParams, searchParams, withDateRange } from '@/lib/schema';
|
||||
import { canViewAuthenticatedWebsite } from '@/permissions';
|
||||
import { getSessionReplays } from '@/queries/sql';
|
||||
|
||||
@@ -10,6 +10,7 @@ export async function GET(
|
||||
) {
|
||||
const schema = withDateRange({
|
||||
...filterParams,
|
||||
...replayParams,
|
||||
...pagingParams,
|
||||
...searchParams,
|
||||
});
|
||||
|
||||
@@ -385,6 +385,7 @@ export const labels: Record<string, string> = {
|
||||
replayEnabled: 'label.replay-enabled',
|
||||
recorderCode: 'label.recorder-code',
|
||||
sampleRate: 'label.sample-rate',
|
||||
minDurationSeconds: 'label.min-duration-seconds',
|
||||
maskLevel: 'label.mask-level',
|
||||
maxDuration: 'label.max-duration',
|
||||
blockSelector: 'label.block-selector',
|
||||
@@ -442,4 +443,5 @@ export const messages: Record<string, string> = {
|
||||
notFound: 'message.not-found',
|
||||
serverError: 'message.sever-error',
|
||||
upgradeRequired: 'message.upgrade-required',
|
||||
replayMinDurationDescription: 'message.replay-min-duration-description',
|
||||
};
|
||||
@@ -1,348 +0,0 @@
|
||||
{
|
||||
"label.access-code": "Pristupni kod",
|
||||
"label.actions": "Akcije",
|
||||
"label.activity": "Dnevnik aktivnosti",
|
||||
"label.add": "Dodaj",
|
||||
"label.add-board": "Dodaj ploču",
|
||||
"label.add-description": "Dodaj opis",
|
||||
"label.add-member": "Dodaj člana",
|
||||
"label.add-step": "Dodaj korak",
|
||||
"label.add-website": "Dodaj web stranicu",
|
||||
"label.admin": "Administrator",
|
||||
"label.affiliate": "Partner",
|
||||
"label.after": "Nakon",
|
||||
"label.all": "Sve",
|
||||
"label.all-time": "Svo vrijeme",
|
||||
"label.analytics": "Analitika",
|
||||
"label.apply": "Primijeni",
|
||||
"label.attribution": "Atribucija",
|
||||
"label.attribution-description": "Pogledajte kako korisnici komuniciraju s vašim marketingom i što dovodi do konverzija.",
|
||||
"label.average": "Prosjek",
|
||||
"label.back": "Natrag",
|
||||
"label.before": "Prije",
|
||||
"label.behavior": "Ponašanje",
|
||||
"label.boards": "Ploče",
|
||||
"label.bounce-rate": "Stopa napuštanja",
|
||||
"label.breakdown": "Raščlamba",
|
||||
"label.browser": "Preglednik",
|
||||
"label.browsers": "Preglednici",
|
||||
"label.campaigns": "Kampanje",
|
||||
"label.cancel": "Odustani",
|
||||
"label.change-password": "Promijeni lozinku",
|
||||
"label.channel": "Kanal",
|
||||
"label.channels": "Kanali",
|
||||
"label.cities": "Gradovi",
|
||||
"label.city": "Grad",
|
||||
"label.clear-all": "Očisti sve",
|
||||
"label.cohort": "Kohorta",
|
||||
"label.cohorts": "Kohorte",
|
||||
"label.compare": "Usporedi",
|
||||
"label.compare-dates": "Usporedi datume",
|
||||
"label.confirm": "Potvrdi",
|
||||
"label.confirm-password": "Potvrdi lozinku",
|
||||
"label.contains": "Sadrži",
|
||||
"label.content": "Sadržaj",
|
||||
"label.continue": "Nastavi",
|
||||
"label.conversion": "Konverzija",
|
||||
"label.conversion-rate": "Stopa konverzije",
|
||||
"label.conversion-step": "Korak konverzije",
|
||||
"label.count": "Broj",
|
||||
"label.countries": "Države",
|
||||
"label.country": "Država",
|
||||
"label.create": "Kreiraj",
|
||||
"label.create-report": "Kreiraj izvještaj",
|
||||
"label.create-team": "Kreiraj tim",
|
||||
"label.create-user": "Kreiraj korisnika",
|
||||
"label.created": "Kreirano",
|
||||
"label.created-by": "Kreirao",
|
||||
"label.currency": "Valuta",
|
||||
"label.current": "Trenutno",
|
||||
"label.current-password": "Trenutna lozinka",
|
||||
"label.custom-range": "Prilagođeni raspon",
|
||||
"label.dashboard": "Nadzorna ploča",
|
||||
"label.data": "Podaci",
|
||||
"label.date": "Datum",
|
||||
"label.date-range": "Raspon datuma",
|
||||
"label.day": "Dan",
|
||||
"label.default-date-range": "Zadani datumski raspon",
|
||||
"label.delete": "Obriši",
|
||||
"label.delete-report": "Obriši izvještaj",
|
||||
"label.delete-team": "Obriši tim",
|
||||
"label.delete-user": "Obriši korisnika",
|
||||
"label.delete-website": "Obriši web stranicu",
|
||||
"label.description": "Opis",
|
||||
"label.desktop": "Stolno računalo",
|
||||
"label.details": "Detalji",
|
||||
"label.device": "Uređaj",
|
||||
"label.devices": "Uređaji",
|
||||
"label.direct": "Direktno",
|
||||
"label.dismiss": "Odbaci",
|
||||
"label.distinct-id": "Jedinstveni ID",
|
||||
"label.does-not-contain": "Ne sadrži",
|
||||
"label.does-not-include": "Ne uključuje",
|
||||
"label.doest-not-exist": "Ne postoji",
|
||||
"label.domain": "Domena",
|
||||
"label.dropoff": "Odlazak",
|
||||
"label.edit": "Uredi",
|
||||
"label.edit-dashboard": "Uredi nadzornu ploču",
|
||||
"label.edit-member": "Uredi člana",
|
||||
"label.email": "E-mail",
|
||||
"label.enable-share-url": "Omogući dijeljenje poveznice",
|
||||
"label.end-step": "Završni korak",
|
||||
"label.entry": "Ulazni URL",
|
||||
"label.event": "Interakcija",
|
||||
"label.event-data": "Podaci interakcije",
|
||||
"label.event-name": "Naziv interakcije",
|
||||
"label.events": "Interakcije",
|
||||
"label.exists": "Postoji",
|
||||
"label.exit": "Izlazni URL",
|
||||
"label.false": "Netočno",
|
||||
"label.field": "Polje",
|
||||
"label.fields": "Polja",
|
||||
"label.filter": "Filter",
|
||||
"label.filter-combined": "Kombinirano",
|
||||
"label.filter-raw": "Izvorno",
|
||||
"label.filters": "Filteri",
|
||||
"label.first-click": "Prvi klik",
|
||||
"label.first-seen": "Prvi put viđeno",
|
||||
"label.funnel": "Tok",
|
||||
"label.funnel-description": "Razumijte stopu konverzije i odlaska korisnika.",
|
||||
"label.funnels": "Tokovi",
|
||||
"label.goal": "Cilj",
|
||||
"label.goals": "Ciljevi",
|
||||
"label.goals-description": "Pratite ciljeve za prikaze stranica i korisničke interakcije.",
|
||||
"label.greater-than": "Veće od",
|
||||
"label.greater-than-equals": "Veće ili jednako",
|
||||
"label.grouped": "Grupirano",
|
||||
"label.hostname": "Naziv hosta",
|
||||
"label.includes": "Uključuje",
|
||||
"label.insight": "Uvid",
|
||||
"label.insights": "Uvidi",
|
||||
"label.insights-description": "Dublje analizirajte svoje podatke pomoću segmenata i filtera.",
|
||||
"label.is": "Je",
|
||||
"label.is-false": "Je netočno",
|
||||
"label.is-not": "Nije",
|
||||
"label.is-not-set": "Nije postavljeno",
|
||||
"label.is-set": "Postavljeno",
|
||||
"label.is-true": "Je točno",
|
||||
"label.join": "Pridruži se",
|
||||
"label.join-team": "Pridruži se timu",
|
||||
"label.journey": "Korisnički put",
|
||||
"label.journey-description": "Razumijte kako se korisnici kreću kroz vašu web stranicu.",
|
||||
"label.journeys": "Korisnički putevi",
|
||||
"label.language": "Jezik",
|
||||
"label.languages": "Jezici",
|
||||
"label.laptop": "Laptop",
|
||||
"label.last-click": "Zadnji klik",
|
||||
"label.last-days": "Zadnjih {x} dana",
|
||||
"label.last-hours": "Zadnjih {x} sati",
|
||||
"label.last-months": "Zadnjih {x} mjeseci",
|
||||
"label.last-seen": "Zadnji put viđeno",
|
||||
"label.leave": "Napusti",
|
||||
"label.leave-team": "Napusti tim",
|
||||
"label.less-than": "Manje od",
|
||||
"label.less-than-equals": "Manje ili jednako",
|
||||
"label.links": "Poveznice",
|
||||
"label.login": "Prijava",
|
||||
"label.logout": "Odjava",
|
||||
"label.manage": "Upravljaj",
|
||||
"label.manager": "Upravitelj",
|
||||
"label.max": "Maksimum",
|
||||
"label.maximize": "Proširi",
|
||||
"label.medium": "Srednje",
|
||||
"label.member": "Član",
|
||||
"label.members": "Članovi",
|
||||
"label.min": "Minimum",
|
||||
"label.mobile": "Mobitel",
|
||||
"label.model": "Model",
|
||||
"label.more": "Više",
|
||||
"label.my-account": "Moj račun",
|
||||
"label.my-websites": "Moje web stranice",
|
||||
"label.name": "Ime",
|
||||
"label.new-password": "Nova lozinka",
|
||||
"label.none": "Nijedan",
|
||||
"label.number-of-records": "{x} {x, plural, one {zapis} other {zapisa}}",
|
||||
"label.ok": "OK",
|
||||
"label.online": "Online",
|
||||
"label.organic-search": "Organsko pretraživanje",
|
||||
"label.organic-shopping": "Organska kupovina",
|
||||
"label.organic-social": "Organska društvena mreža",
|
||||
"label.organic-video": "Organski videozapis",
|
||||
"label.os": "OS",
|
||||
"label.other": "Ostalo",
|
||||
"label.overview": "Pregled",
|
||||
"label.owner": "Vlasnik",
|
||||
"label.page": "Stranica",
|
||||
"label.page-of": "Stranica {current} od {total}",
|
||||
"label.page-views": "Pregledi stranica",
|
||||
"label.pageTitle": "Naslov stranice",
|
||||
"label.pages": "Stranice",
|
||||
"label.paid-ads": "Plaćeni oglasi",
|
||||
"label.paid-search": "Plaćeno pretraživanje",
|
||||
"label.paid-shopping": "Plaćena kupovina",
|
||||
"label.paid-social": "Plaćena društvena mreža",
|
||||
"label.paid-video": "Plaćeni videozapis",
|
||||
"label.password": "Lozinka",
|
||||
"label.path": "Putanja",
|
||||
"label.paths": "Putanje",
|
||||
"label.pixels": "Pikseli",
|
||||
"label.powered-by": "Pokreće {name}",
|
||||
"label.previous": "Prethodno",
|
||||
"label.previous-period": "Prethodno razdoblje",
|
||||
"label.previous-year": "Prethodna godina",
|
||||
"label.profile": "Profil",
|
||||
"label.properties": "Svojstva",
|
||||
"label.property": "Svojstvo",
|
||||
"label.queries": "Upiti",
|
||||
"label.query": "Upit",
|
||||
"label.query-parameters": "Parametri upita",
|
||||
"label.realtime": "Stvarno vrijeme",
|
||||
"label.referral": "Preporuka",
|
||||
"label.referrer": "Izvor",
|
||||
"label.referrers": "Izvori",
|
||||
"label.refresh": "Osvježi",
|
||||
"label.regenerate": "Regeneriraj",
|
||||
"label.region": "Regija",
|
||||
"label.regions": "Regije",
|
||||
"label.remaining": "Preostalo",
|
||||
"label.remove": "Ukloni",
|
||||
"label.remove-member": "Ukloni člana",
|
||||
"label.reports": "Izvještaji",
|
||||
"label.required": "Obavezno",
|
||||
"label.reset": "Resetiraj",
|
||||
"label.reset-website": "Resetiraj web stranicu",
|
||||
"label.retention": "Zadržavanje",
|
||||
"label.retention-description": "Pratite koliko se često korisnici vraćaju na vašu web stranicu.",
|
||||
"label.revenue": "Prihod",
|
||||
"label.revenue-description": "Pogledajte svoj prihod tijekom vremena.",
|
||||
"label.role": "Uloga",
|
||||
"label.run-query": "Pokreni upit",
|
||||
"label.save": "Spremi",
|
||||
"label.screen": "Ekran",
|
||||
"label.screens": "Ekrani",
|
||||
"label.search": "Pretraživanje",
|
||||
"label.select": "Odaberi",
|
||||
"label.select-date": "Odaberi datum",
|
||||
"label.select-filter": "Odaberi filter",
|
||||
"label.select-role": "Odaberi ulogu",
|
||||
"label.select-website": "Odaberi web stranicu",
|
||||
"label.session": "Sesija",
|
||||
"label.session-data": "Podaci sesije",
|
||||
"label.sessions": "Sesije",
|
||||
"label.settings": "Postavke",
|
||||
"label.share": "Podijeli",
|
||||
"label.share-url": "Podijeli poveznicu",
|
||||
"label.single-day": "Jedan dan",
|
||||
"label.sms": "SMS",
|
||||
"label.sources": "Izvori",
|
||||
"label.start-step": "Početni korak",
|
||||
"label.steps": "Koraci",
|
||||
"label.sum": "Zbroj",
|
||||
"label.tablet": "Tablet",
|
||||
"label.tag": "Oznaka",
|
||||
"label.tags": "Oznake",
|
||||
"label.team": "Tim",
|
||||
"label.team-id": "ID tima",
|
||||
"label.team-manager": "Voditelj tima",
|
||||
"label.team-member": "Član tima",
|
||||
"label.team-name": "Naziv tima",
|
||||
"label.team-owner": "Vlasnik tima",
|
||||
"label.team-settings": "Postavke tima",
|
||||
"label.team-view-only": "Tim (samo pregled)",
|
||||
"label.team-websites": "Web stranice tima",
|
||||
"label.teams": "Timovi",
|
||||
"label.terms": "Pojmovi",
|
||||
"label.theme": "Tema",
|
||||
"label.this-month": "Ovaj mjesec",
|
||||
"label.this-week": "Ovaj tjedan",
|
||||
"label.this-year": "Ova godina",
|
||||
"label.timezone": "Vremenska zona",
|
||||
"label.title": "Naslov",
|
||||
"label.today": "Danas",
|
||||
"label.toggle-charts": "Prikaži/sakrij grafikone",
|
||||
"label.total": "Ukupno",
|
||||
"label.total-records": "Ukupno zapisa",
|
||||
"label.tracking-code": "Kod za praćenje",
|
||||
"label.transactions": "Transakcije",
|
||||
"label.transfer": "Prenesi",
|
||||
"label.transfer-website": "Prenesi web stranicu",
|
||||
"label.true": "Da",
|
||||
"label.type": "Vrsta",
|
||||
"label.unique": "Jedinstveno",
|
||||
"label.unique-visitors": "Jedinstveni posjetitelji",
|
||||
"label.uniqueCustomers": "Jedinstveni kupci",
|
||||
"label.unknown": "Nepoznato",
|
||||
"label.untitled": "Bez naslova",
|
||||
"label.update": "Ažuriraj",
|
||||
"label.user": "Korisnik",
|
||||
"label.username": "Korisničko ime",
|
||||
"label.users": "Korisnici",
|
||||
"label.utm": "UTM",
|
||||
"label.utm-description": "Pratite svoje kampanje putem UTM parametara.",
|
||||
"label.value": "Vrijednost",
|
||||
"label.view": "Prikaži",
|
||||
"label.view-details": "Pogledaj detalje",
|
||||
"label.view-only": "Samo pregled",
|
||||
"label.views": "Pregledi",
|
||||
"label.views-per-visit": "Pregledi po posjetu",
|
||||
"label.visit-duration": "Trajanje posjeta",
|
||||
"label.visitors": "Posjetitelji",
|
||||
"label.visits": "Posjeti",
|
||||
"label.website": "Web stranica",
|
||||
"label.website-id": "ID web stranice",
|
||||
"label.websites": "Web stranice",
|
||||
"label.window": "Prozor",
|
||||
"label.yesterday": "Jučer",
|
||||
"label.environment": "Okruženje",
|
||||
"label.criteria": "Kriteriji",
|
||||
"label.location": "Lokacija",
|
||||
"label.segments": "Segmenti",
|
||||
"label.traffic": "Promet",
|
||||
"label.support": "Podrška",
|
||||
"message.action-confirmation": "Upišite {confirmation} u polje ispod kako biste potvrdili.",
|
||||
"message.active-users": "{x} Trenutno {x, plural, one {posjetitelj} other {posjetitelja}}",
|
||||
"message.bad-request": "Neispravan zahtjev",
|
||||
"message.collected-data": "Prikupljeni podaci",
|
||||
"message.confirm-delete": "Jeste li sigurni da želite obrisati {target}?",
|
||||
"message.confirm-leave": "Jeste li sigurni da želite napustiti {target}?",
|
||||
"message.confirm-remove": "Jeste li sigurni da želite ukloniti {target}?",
|
||||
"message.confirm-reset": "Jeste li sigurni da želite resetirati statistiku za {target}?",
|
||||
"message.delete-team-warning": "Brisanjem tima brišu se i sve web stranice tog tima.",
|
||||
"message.delete-website-warning": "Svi podaci web stranice bit će obrisani.",
|
||||
"message.error": "Nešto je pošlo po zlu.",
|
||||
"message.event-log": "{event} na {url}",
|
||||
"message.forbidden": "Zabranjeno",
|
||||
"message.go-to-settings": "Idi u postavke",
|
||||
"message.incorrect-username-password": "Neispravno korisničke ime ili lozinka.",
|
||||
"message.invalid-domain": "Neispravna domena. Nemojte unositi http/https.",
|
||||
"message.min-password-length": "Minimalna duljina je {n} znakova",
|
||||
"message.new-version-available": "Dostupna je nova verzija - Umami {version}!",
|
||||
"message.no-data-available": "Nema dostupnih podataka.",
|
||||
"message.no-event-data": "Nema dostupnih podataka o događajima.",
|
||||
"message.no-match-password": "Lozinke se ne podudaraju.",
|
||||
"message.no-results-found": "Nema pronađenih rezultata.",
|
||||
"message.no-team-websites": "Ovaj tim nema nijednu web stranicu.",
|
||||
"message.no-teams": "Niste kreirali nijedan tim.",
|
||||
"message.no-users": "Nema korisnika.",
|
||||
"message.no-websites-configured": "Nemate konfiguriranih web stranica.",
|
||||
"message.not-found": "Nije pronađeno",
|
||||
"message.nothing-selected": "Ništa nije odabrano.",
|
||||
"message.page-not-found": "Stranica nije pronađena.",
|
||||
"message.reset-website": "Za resetiranje ove web stranice upišite {confirmation} u polje ispod.",
|
||||
"message.reset-website-warning": "Sve statistike ove web stranice bit će obrisane, ali postavke ostaju sačuvane.",
|
||||
"message.saved": "Spremljeno.",
|
||||
"message.sever-error": "Greška na poslužitelju",
|
||||
"message.share-url": "Ovo je javno dijeljena poveznica za {target}.",
|
||||
"message.team-already-member": "Već ste član ovog tima.",
|
||||
"message.team-not-found": "Tim nije pronađen.",
|
||||
"message.team-websites-info": "Web stranice su vidljive svim članovima tima.",
|
||||
"message.tracking-code": "Za praćenje statistike ove web stranice postavite sljedeći kod u <head>...</head> dio vašeg HTML‑a.",
|
||||
"message.transfer-team-website-to-user": "Želite prenijeti ovu web stranicu na vaš račun?",
|
||||
"message.transfer-user-website-to-team": "Odaberite tim kojem želite prenijeti ovu web stranicu.",
|
||||
"message.transfer-website": "Prenesite vlasništvo nad web stranicom na svoj račun ili drugi tim.",
|
||||
"message.triggered-event": "Izvršen (triggered) događaj",
|
||||
"message.unauthorized": "Nedozvoljen pristup",
|
||||
"message.user-deleted": "Korisnik obrisan.",
|
||||
"message.viewed-page": "Pregledana stranica",
|
||||
"message.visitor-log": "Posjetitelj iz {country} koristi {browser} na {os} ({device})"
|
||||
}
|
||||
@@ -168,6 +168,7 @@ export async function getQueryFilters(
|
||||
...dateRange,
|
||||
...filters,
|
||||
match,
|
||||
minDuration: params?.minDuration,
|
||||
page: params?.page,
|
||||
pageSize: params?.pageSize ? params?.pageSize || DEFAULT_PAGE_SIZE : undefined,
|
||||
orderBy: params?.orderBy,
|
||||
|
||||
@@ -74,6 +74,10 @@ export const searchParams = {
|
||||
search: z.string().optional(),
|
||||
};
|
||||
|
||||
export const replayParams = {
|
||||
minDuration: z.coerce.number().int().nonnegative().optional(),
|
||||
};
|
||||
|
||||
export const pagingParams = {
|
||||
page: z.coerce.number().int().positive().optional(),
|
||||
pageSize: z.coerce.number().int().positive().optional(),
|
||||
|
||||
@@ -124,6 +124,7 @@ export interface QueryFilters
|
||||
SortParams,
|
||||
PageParams,
|
||||
SegmentParams {
|
||||
minDuration?: number;
|
||||
cohortFilters?: QueryFilters;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@ export function getSessionReplays(
|
||||
|
||||
async function relationalQuery(websiteId: string, filters: QueryFilters, sessionId?: string) {
|
||||
const { pagedRawQuery, parseFilters } = prisma;
|
||||
const { search } = filters;
|
||||
const { search, minDuration } = filters;
|
||||
const minDurationMs = minDuration && minDuration > 0 ? minDuration * 1000 : undefined;
|
||||
const { filterQuery, cohortQuery, queryParams, joinSessionQuery } = parseFilters({
|
||||
...filters,
|
||||
websiteId,
|
||||
@@ -47,6 +48,10 @@ async function relationalQuery(websiteId: string, filters: QueryFilters, session
|
||||
or session.device ilike {{search}})`
|
||||
: '';
|
||||
|
||||
const havingQuery = minDurationMs
|
||||
? `having sum(extract(epoch from sr.ended_at - sr.started_at) * 1000) >= {{minDurationMs}}`
|
||||
: '';
|
||||
|
||||
return pagedRawQuery(
|
||||
`
|
||||
select
|
||||
@@ -80,9 +85,10 @@ async function relationalQuery(websiteId: string, filters: QueryFilters, session
|
||||
session.device,
|
||||
session.country,
|
||||
session.city
|
||||
${havingQuery}
|
||||
order by max(sr.created_at) desc
|
||||
`,
|
||||
{ ...queryParams, sessionId },
|
||||
{ ...queryParams, sessionId, minDurationMs },
|
||||
filters,
|
||||
FUNCTION_NAME,
|
||||
);
|
||||
@@ -90,7 +96,8 @@ async function relationalQuery(websiteId: string, filters: QueryFilters, session
|
||||
|
||||
async function clickhouseQuery(websiteId: string, filters: QueryFilters, sessionId?: string) {
|
||||
const { pagedRawQuery, parseFilters } = clickhouse;
|
||||
const { search } = filters;
|
||||
const { search, minDuration } = filters;
|
||||
const minDurationMs = minDuration && minDuration > 0 ? minDuration * 1000 : undefined;
|
||||
const { queryParams, cohortQuery, filterQuery } = parseFilters({
|
||||
...filters,
|
||||
websiteId,
|
||||
@@ -106,6 +113,10 @@ async function clickhouseQuery(websiteId: string, filters: QueryFilters, session
|
||||
or (positionCaseInsensitive(device, {search:String}) > 0))`
|
||||
: '';
|
||||
|
||||
const havingQuery = minDurationMs
|
||||
? `having toInt64(sum(dateDiff('millisecond', session_replay.started_at, session_replay.ended_at))) >= {minDurationMs:Int64}`
|
||||
: '';
|
||||
|
||||
return pagedRawQuery(
|
||||
`
|
||||
select
|
||||
@@ -140,9 +151,10 @@ async function clickhouseQuery(websiteId: string, filters: QueryFilters, session
|
||||
and session_replay.created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||
${sessionFilter}
|
||||
group by session_replay.visit_id, session_replay.session_id, session_replay.website_id, website_event.browser, website_event.os, website_event.device, website_event.country, website_event.city
|
||||
${havingQuery}
|
||||
order by max(created_at) desc
|
||||
`,
|
||||
{ ...queryParams, sessionId },
|
||||
{ ...queryParams, sessionId, minDurationMs },
|
||||
filters,
|
||||
FUNCTION_NAME,
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user