simple-module-analytics 0.0.15__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. simple_module_analytics-0.0.15.dist-info/METADATA +57 -0
  2. simple_module_analytics-0.0.15.dist-info/RECORD +50 -0
  3. simple_module_analytics-0.0.15.dist-info/WHEEL +4 -0
  4. simple_module_analytics-0.0.15.dist-info/entry_points.txt +2 -0
  5. sm_analytics/__init__.py +1 -0
  6. sm_analytics/collection/__init__.py +1 -0
  7. sm_analytics/collection/privacy.py +85 -0
  8. sm_analytics/collection/retention.py +33 -0
  9. sm_analytics/collection/service.py +105 -0
  10. sm_analytics/core/__init__.py +1 -0
  11. sm_analytics/core/constants.py +15 -0
  12. sm_analytics/core/geo.py +133 -0
  13. sm_analytics/core/runtime.py +58 -0
  14. sm_analytics/core/settings.py +22 -0
  15. sm_analytics/core/tenancy.py +26 -0
  16. sm_analytics/index.ts +3 -0
  17. sm_analytics/locales/de.json +118 -0
  18. sm_analytics/locales/en.json +118 -0
  19. sm_analytics/models/__init__.py +87 -0
  20. sm_analytics/module.py +103 -0
  21. sm_analytics/package.json +21 -0
  22. sm_analytics/pages/Dashboard.tsx +164 -0
  23. sm_analytics/reporting/__init__.py +1 -0
  24. sm_analytics/reporting/reports.py +145 -0
  25. sm_analytics/ui/components/DateRangeControl.tsx +126 -0
  26. sm_analytics/ui/components/DeleteProperty.tsx +68 -0
  27. sm_analytics/ui/components/FilterChips.tsx +74 -0
  28. sm_analytics/ui/components/PropertyEditor.tsx +189 -0
  29. sm_analytics/ui/components/PropertySettings.tsx +120 -0
  30. sm_analytics/ui/components/RankingPanel.tsx +119 -0
  31. sm_analytics/ui/components/RecentActivity.tsx +63 -0
  32. sm_analytics/ui/components/ReportExport.tsx +63 -0
  33. sm_analytics/ui/components/ReportFilters.tsx +119 -0
  34. sm_analytics/ui/components/ReportView.tsx +86 -0
  35. sm_analytics/ui/components/TrafficChart.tsx +123 -0
  36. sm_analytics/ui/utils/api.ts +52 -0
  37. sm_analytics/ui/utils/csrf.ts +46 -0
  38. sm_analytics/ui/utils/hostTracker.ts +52 -0
  39. sm_analytics/ui/utils/i18n.ts +89 -0
  40. sm_analytics/ui/utils/reportExport.ts +48 -0
  41. sm_analytics/ui/utils/tracker.ts +102 -0
  42. sm_analytics/ui/utils/trackingPaths.ts +36 -0
  43. sm_analytics/ui/utils/types.ts +55 -0
  44. sm_analytics/ui/utils/useAnalytics.ts +111 -0
  45. sm_analytics/web/__init__.py +1 -0
  46. sm_analytics/web/deps.py +30 -0
  47. sm_analytics/web/endpoints/__init__.py +1 -0
  48. sm_analytics/web/endpoints/admin.py +115 -0
  49. sm_analytics/web/endpoints/public.py +76 -0
  50. sm_analytics/web/schemas.py +132 -0
@@ -0,0 +1,120 @@
1
+ import { Button } from '@simple-module-py/ui/components/ui/button';
2
+ import {
3
+ Dialog,
4
+ DialogContent,
5
+ DialogDescription,
6
+ DialogTitle,
7
+ DialogTrigger,
8
+ } from '@simple-module-py/ui/components/ui/dialog';
9
+ import { useState } from 'react';
10
+ import { keys, useT } from '../utils/i18n';
11
+ import type { GeoStatus, Property, PropertyInput } from '../utils/types';
12
+ import { DeleteProperty } from './DeleteProperty';
13
+ import { PropertyEditor } from './PropertyEditor';
14
+
15
+ export function PropertySettings({
16
+ canManage,
17
+ property,
18
+ geo,
19
+ onSave,
20
+ onDelete,
21
+ }: {
22
+ canManage: boolean;
23
+ property?: Property;
24
+ geo: GeoStatus | null;
25
+ onSave: (input: PropertyInput, id?: string) => Promise<void>;
26
+ onDelete: () => Promise<void>;
27
+ }) {
28
+ const { t } = useT();
29
+ const [open, setOpen] = useState(false);
30
+ const [busy, setBusy] = useState(false);
31
+ const [editing, setEditing] = useState<'new' | 'edit' | null>(null);
32
+ if (!canManage) return null;
33
+ return (
34
+ <Dialog
35
+ open={open}
36
+ onOpenChange={(next) => {
37
+ if (busy) return;
38
+ setEditing(property ? null : 'new');
39
+ setOpen(next);
40
+ }}
41
+ >
42
+ <DialogTrigger asChild>
43
+ <Button variant="outline">
44
+ {t(property ? keys.analytics.ui.manage : keys.analytics.new_property)}
45
+ </Button>
46
+ </DialogTrigger>
47
+ <DialogContent
48
+ className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-2xl"
49
+ showCloseButton={false}
50
+ >
51
+ <DialogTitle>{t(keys.analytics.ui.settings)}</DialogTitle>
52
+ <DialogDescription>{t(keys.analytics.setup_help)}</DialogDescription>
53
+ {editing ? (
54
+ <PropertyEditor
55
+ key={editing === 'edit' ? property?.id : 'new'}
56
+ property={editing === 'edit' ? property : undefined}
57
+ onCancel={() => (property ? setEditing(null) : setOpen(false))}
58
+ onSave={async (input) => {
59
+ setBusy(true);
60
+ try {
61
+ await onSave(input, editing === 'edit' ? property?.id : undefined);
62
+ setOpen(false);
63
+ } finally {
64
+ setBusy(false);
65
+ }
66
+ }}
67
+ />
68
+ ) : (
69
+ <>
70
+ <div className="flex flex-wrap gap-2">
71
+ <Button onClick={() => setEditing('new')}>{t(keys.analytics.new_property)}</Button>
72
+ {property && (
73
+ <Button variant="outline" onClick={() => setEditing('edit')}>
74
+ {t(keys.analytics.edit)}
75
+ </Button>
76
+ )}
77
+ </div>
78
+ {property && (
79
+ <section className="min-w-0 space-y-2 rounded-md border p-4">
80
+ <h2 className="font-medium">{t(keys.analytics.setup)}</h2>
81
+ <p className="break-all text-xs text-muted-foreground">{property.id}</p>
82
+ </section>
83
+ )}
84
+ {geo && (
85
+ <aside className="space-y-1 text-sm text-muted-foreground">
86
+ <p>
87
+ {t(
88
+ !geo.enabled
89
+ ? keys.analytics.geo_disabled
90
+ : geo.available
91
+ ? keys.analytics.geo_ready
92
+ : keys.analytics.geo_unavailable,
93
+ )}
94
+ </p>
95
+ {geo.age_days !== null && (
96
+ <p>{t(keys.analytics.geo_age, { days: geo.age_days })}</p>
97
+ )}
98
+ </aside>
99
+ )}
100
+ {property && (
101
+ <div className="border-t pt-4">
102
+ <DeleteProperty
103
+ onDelete={async () => {
104
+ await onDelete();
105
+ setOpen(false);
106
+ }}
107
+ />
108
+ </div>
109
+ )}
110
+ </>
111
+ )}
112
+ <div className="flex justify-end">
113
+ <Button variant="outline" disabled={busy} onClick={() => setOpen(false)}>
114
+ {t(keys.analytics.ui.close)}
115
+ </Button>
116
+ </div>
117
+ </DialogContent>
118
+ </Dialog>
119
+ );
120
+ }
@@ -0,0 +1,119 @@
1
+ import { Button } from '@simple-module-py/ui/components/ui/button';
2
+ import { Tabs, TabsContent, TabsList, TabsTrigger } from '@simple-module-py/ui/components/ui/tabs';
3
+ import { useId, useState } from 'react';
4
+ import { keys, useT } from '../utils/i18n';
5
+ import type { Breakdown, Dimension } from '../utils/types';
6
+
7
+ export type RankingDimension = Dimension | `property:${string}`;
8
+ export function RankingPanel({
9
+ title,
10
+ groups,
11
+ onFilter,
12
+ help,
13
+ }: {
14
+ title: string;
15
+ groups: { dimension: RankingDimension; rows: Breakdown[] }[];
16
+ onFilter: (dimension: RankingDimension, value: string) => void;
17
+ help?: string;
18
+ }) {
19
+ const { t, locale } = useT();
20
+ const heading = useId();
21
+ const [selected, setSelected] = useState(groups[0].dimension);
22
+ const [expanded, setExpanded] = useState(false);
23
+ const active = groups.find((group) => group.dimension === selected) ?? groups[0];
24
+ const label = (dimension: RankingDimension) =>
25
+ dimension.startsWith('property:')
26
+ ? t(keys.analytics.event_property, { name: dimension.slice(9) })
27
+ : t(keys.analytics.dimensions[dimension as Dimension]);
28
+ const maximum = Math.max(1, ...active.rows.map((row) => row.count));
29
+ const actionable = ['path', 'event', 'country', 'region', 'city'].includes(active.dimension);
30
+ const content = (
31
+ <>
32
+ {active.rows.length === 0 ? (
33
+ <p className="py-8 text-sm text-muted-foreground">{t(keys.analytics.no_data)}</p>
34
+ ) : (
35
+ <table className="w-full table-fixed text-sm">
36
+ <caption className="sr-only">{label(active.dimension)}</caption>
37
+ <thead>
38
+ <tr className="text-left text-muted-foreground">
39
+ <th className="pb-3 font-normal">{t(keys.analytics.value)}</th>
40
+ <th className="w-20 pb-3 text-right font-normal">{t(keys.analytics.count)}</th>
41
+ </tr>
42
+ </thead>
43
+ <tbody>
44
+ {active.rows.slice(0, expanded ? active.rows.length : 10).map((row) => {
45
+ const name = row.value ? row.label : t(keys.analytics.unknown);
46
+ return (
47
+ <tr key={row.value}>
48
+ <td className="py-1 pr-3">
49
+ <div className="relative min-w-0 rounded-sm">
50
+ <span
51
+ aria-hidden="true"
52
+ className="absolute inset-y-0 left-0 rounded-sm bg-blue-500/10 dark:bg-blue-400/15"
53
+ style={{ width: `${(row.count / maximum) * 100}%` }}
54
+ />
55
+ {actionable ? (
56
+ <button
57
+ type="button"
58
+ className="relative block w-full break-words rounded-sm px-2 py-2 text-left [overflow-wrap:anywhere] hover:text-blue-600 focus-visible:outline-ring dark:hover:text-blue-400"
59
+ onClick={() => onFilter(active.dimension, row.value || '__unknown__')}
60
+ >
61
+ {name}
62
+ </button>
63
+ ) : (
64
+ <span className="relative block break-words px-2 py-2 [overflow-wrap:anywhere]">
65
+ {name}
66
+ </span>
67
+ )}
68
+ </div>
69
+ </td>
70
+ <td className="text-right tabular-nums">{row.count.toLocaleString(locale)}</td>
71
+ </tr>
72
+ );
73
+ })}
74
+ </tbody>
75
+ </table>
76
+ )}
77
+ {active.rows.length > 10 && (
78
+ <Button variant="ghost" size="sm" className="mt-3" onClick={() => setExpanded(!expanded)}>
79
+ {t(expanded ? keys.analytics.ui.show_less : keys.analytics.ui.show_more)}
80
+ </Button>
81
+ )}
82
+ </>
83
+ );
84
+ return (
85
+ <section aria-labelledby={heading} className="min-w-0 rounded-lg border bg-card p-4 sm:p-5">
86
+ <h2 id={heading} className="font-semibold">
87
+ {title}
88
+ </h2>
89
+ {help && <p className="mt-1 text-sm text-muted-foreground">{help}</p>}
90
+ {groups.length === 1 ? (
91
+ <div className="mt-4">{content}</div>
92
+ ) : (
93
+ <Tabs
94
+ value={active.dimension}
95
+ onValueChange={(value) => {
96
+ setSelected(value as RankingDimension);
97
+ setExpanded(false);
98
+ }}
99
+ className="mt-3 min-w-0 gap-4"
100
+ >
101
+ <div className="min-w-0 overflow-x-auto pb-1">
102
+ <TabsList variant="line" aria-label={title}>
103
+ {groups.map(({ dimension }) => (
104
+ <TabsTrigger key={dimension} value={dimension}>
105
+ {label(dimension)}
106
+ </TabsTrigger>
107
+ ))}
108
+ </TabsList>
109
+ </div>
110
+ {groups.map(({ dimension }) => (
111
+ <TabsContent key={dimension} value={dimension}>
112
+ {dimension === active.dimension ? content : null}
113
+ </TabsContent>
114
+ ))}
115
+ </Tabs>
116
+ )}
117
+ </section>
118
+ );
119
+ }
@@ -0,0 +1,63 @@
1
+ import { useId } from 'react';
2
+ import { keys, useT } from '../utils/i18n';
3
+ import type { Report } from '../utils/types';
4
+
5
+ export function RecentActivity({ recent }: { recent: Report['recent'] }) {
6
+ const { t, locale } = useT();
7
+ const titleId = useId();
8
+ return (
9
+ <section className="min-w-0 rounded-lg border bg-card p-4 sm:p-5">
10
+ <h2 id={titleId} className="font-semibold">
11
+ {t(keys.analytics.recent)}
12
+ </h2>
13
+ <p className="mt-1 text-sm text-muted-foreground">{t(keys.analytics.recent_help)}</p>
14
+ <p className="my-3 text-sm">
15
+ {t(keys.analytics.recent_visitors)}:{' '}
16
+ <strong>{recent.visitors.toLocaleString(locale)}</strong>
17
+ </p>
18
+ {recent.events.length === 0 ? (
19
+ <p className="text-sm text-muted-foreground">{t(keys.analytics.no_data)}</p>
20
+ ) : (
21
+ <section
22
+ aria-labelledby={titleId}
23
+ // biome-ignore lint/a11y/noNoninteractiveTabindex: A scrollable region needs keyboard access to all activity rows.
24
+ tabIndex={0}
25
+ className="max-h-80 overflow-auto rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
26
+ >
27
+ <table className="w-full table-fixed text-sm">
28
+ <thead>
29
+ <tr className="border-b text-left">
30
+ <th className="w-24 pb-2">{t(keys.analytics.time)}</th>
31
+ <th>{t(keys.analytics.page_filter)}</th>
32
+ <th>{t(keys.analytics.event_filter)}</th>
33
+ <th>{t(keys.analytics.location)}</th>
34
+ </tr>
35
+ </thead>
36
+ <tbody>
37
+ {recent.events.map((event) => (
38
+ <tr key={event.event_id} className="border-b last:border-0">
39
+ <td className="whitespace-nowrap py-2 pr-4">
40
+ {new Date(event.created_at).toLocaleTimeString(locale, { timeZone: 'UTC' })}
41
+ </td>
42
+ <td className="break-all py-2 pr-4">{event.path}</td>
43
+ <td className="break-words py-2 pr-4">
44
+ {event.name || t(keys.analytics.pageviews)}
45
+ </td>
46
+ <td className="break-words py-2 [overflow-wrap:anywhere]">
47
+ {[
48
+ event.city_name || event.city,
49
+ event.region_name || event.region,
50
+ event.country_name || event.country,
51
+ ]
52
+ .filter(Boolean)
53
+ .join(', ') || t(keys.analytics.unknown)}
54
+ </td>
55
+ </tr>
56
+ ))}
57
+ </tbody>
58
+ </table>
59
+ </section>
60
+ )}
61
+ </section>
62
+ );
63
+ }
@@ -0,0 +1,63 @@
1
+ import { Button } from '@simple-module-py/ui/components/ui/button';
2
+ import { useState } from 'react';
3
+ import { keys, useT } from '../utils/i18n';
4
+ import { reportCsv } from '../utils/reportExport';
5
+ import type { Filters, Property, Report } from '../utils/types';
6
+
7
+ export function ReportExport({
8
+ property,
9
+ report,
10
+ filters,
11
+ busy,
12
+ }: {
13
+ property: Property;
14
+ report: Report | null;
15
+ filters: Filters;
16
+ busy: boolean;
17
+ }) {
18
+ const { t } = useT();
19
+ const [failed, setFailed] = useState(false);
20
+ const download = () => {
21
+ if (!report || busy) return;
22
+ setFailed(false);
23
+ try {
24
+ const blob = new Blob([reportCsv(property, filters, report)], {
25
+ type: 'text/csv;charset=utf-8',
26
+ });
27
+ const url = URL.createObjectURL(blob);
28
+ const anchor = document.createElement('a');
29
+ const parts = [property.id, filters.start, filters.end].map((part) =>
30
+ part.replace(/[^a-zA-Z0-9_-]/g, '_'),
31
+ );
32
+ anchor.href = url;
33
+ anchor.download = `analytics-${parts.join('-')}.csv`;
34
+ document.body.append(anchor);
35
+ try {
36
+ anchor.click();
37
+ } finally {
38
+ anchor.remove();
39
+ setTimeout(() => URL.revokeObjectURL(url), 1000);
40
+ }
41
+ } catch {
42
+ setFailed(true);
43
+ }
44
+ };
45
+ return (
46
+ <div>
47
+ <Button
48
+ variant="ghost"
49
+ size="sm"
50
+ disabled={!report || busy}
51
+ onClick={download}
52
+ title={t(keys.analytics.ui.export_help)}
53
+ >
54
+ {t(keys.analytics.ui.export_csv)}
55
+ </Button>
56
+ {failed && (
57
+ <p role="alert" className="text-xs text-destructive">
58
+ {t(keys.analytics.ui.export_failed)}
59
+ </p>
60
+ )}
61
+ </div>
62
+ );
63
+ }
@@ -0,0 +1,119 @@
1
+ import { Button } from '@simple-module-py/ui/components/ui/button';
2
+ import { Input } from '@simple-module-py/ui/components/ui/input';
3
+ import { Label } from '@simple-module-py/ui/components/ui/label';
4
+ import {
5
+ Popover,
6
+ PopoverContent,
7
+ PopoverTrigger,
8
+ } from '@simple-module-py/ui/components/ui/popover';
9
+ import { useId, useState } from 'react';
10
+ import { keys, useT } from '../utils/i18n';
11
+ import type { Filters, Report } from '../utils/types';
12
+
13
+ export function ReportFilters({
14
+ value,
15
+ onChange,
16
+ report,
17
+ }: {
18
+ value: Filters;
19
+ onChange: (filters: Filters) => void;
20
+ report: Report | null;
21
+ }) {
22
+ const { t } = useT();
23
+ const id = useId();
24
+ const [open, setOpen] = useState(false);
25
+ const [draft, setDraft] = useState(value);
26
+ const set = (key: keyof Filters, next: string) =>
27
+ setDraft({
28
+ ...draft,
29
+ [key]: next,
30
+ ...(key === 'country' ? { region: '', city: '' } : key === 'region' ? { city: '' } : {}),
31
+ });
32
+ const geoFields = ['country', 'region', 'city'] as const;
33
+ const inputFields = ['path', 'event'] as const;
34
+ const inputLabels = {
35
+ path: keys.analytics.page_filter,
36
+ event: keys.analytics.event_filter,
37
+ };
38
+ return (
39
+ <Popover
40
+ open={open}
41
+ onOpenChange={(next) => {
42
+ setDraft(value);
43
+ setOpen(next);
44
+ }}
45
+ >
46
+ <PopoverTrigger asChild>
47
+ <Button variant="outline">{t(keys.analytics.ui.filters_button)}</Button>
48
+ </PopoverTrigger>
49
+ <PopoverContent align="end" className="w-[min(28rem,calc(100vw-2rem))]">
50
+ <fieldset>
51
+ <legend className="px-2 text-sm font-medium">{t(keys.analytics.filters)}</legend>
52
+ <div className="grid gap-4 sm:grid-cols-2">
53
+ {inputFields.map((key) => (
54
+ <div key={key} className="space-y-2">
55
+ <Label htmlFor={`${id}-${key}`}>{t(inputLabels[key])}</Label>
56
+ <Input
57
+ id={`${id}-${key}`}
58
+ type="text"
59
+ value={draft[key]}
60
+ onChange={(e) => set(key, e.target.value)}
61
+ />
62
+ </div>
63
+ ))}
64
+ </div>
65
+ <div className="mt-4 grid items-end gap-4 sm:grid-cols-3">
66
+ {geoFields.map((key) => {
67
+ const options = report?.breakdowns[key] ?? [];
68
+ const selected = draft[key];
69
+ return (
70
+ <div key={key} className="space-y-2">
71
+ <Label htmlFor={`${id}-${key}`}>{t(keys.analytics[key])}</Label>
72
+ <select
73
+ id={`${id}-${key}`}
74
+ value={selected}
75
+ onChange={(e) => set(key, e.target.value)}
76
+ className="h-10 w-full rounded-md border bg-background px-3 text-sm"
77
+ >
78
+ <option value="">{t(keys.analytics.all)}</option>
79
+ {selected &&
80
+ !options.some((row) => (row.value || '__unknown__') === selected) && (
81
+ <option value={selected}>
82
+ {selected === '__unknown__' ? t(keys.analytics.unknown) : selected}
83
+ </option>
84
+ )}
85
+ {options.map((row) => (
86
+ <option key={row.value} value={row.value || '__unknown__'}>
87
+ {row.value ? row.label : t(keys.analytics.unknown)}
88
+ </option>
89
+ ))}
90
+ </select>
91
+ </div>
92
+ );
93
+ })}
94
+ </div>
95
+ <div className="mt-4 flex justify-end gap-2">
96
+ <Button variant="outline" onClick={() => setOpen(false)}>
97
+ {t(keys.analytics.cancel)}
98
+ </Button>
99
+ <Button
100
+ onClick={() => {
101
+ onChange({
102
+ ...value,
103
+ path: draft.path,
104
+ event: draft.event,
105
+ country: draft.country,
106
+ region: draft.region,
107
+ city: draft.city,
108
+ });
109
+ setOpen(false);
110
+ }}
111
+ >
112
+ {t(keys.analytics.ui.apply)}
113
+ </Button>
114
+ </div>
115
+ </fieldset>
116
+ </PopoverContent>
117
+ </Popover>
118
+ );
119
+ }
@@ -0,0 +1,86 @@
1
+ import { keys, useT } from '../utils/i18n';
2
+ import type { Filters, Report } from '../utils/types';
3
+ import { type RankingDimension, RankingPanel } from './RankingPanel';
4
+ import { RecentActivity } from './RecentActivity';
5
+ import { TrafficChart } from './TrafficChart';
6
+
7
+ export function ReportView({
8
+ report,
9
+ filters,
10
+ onFilter,
11
+ }: {
12
+ report: Report;
13
+ filters: Filters;
14
+ onFilter: (filters: Filters) => void;
15
+ }) {
16
+ const { t, locale } = useT();
17
+ const choose = (dimension: RankingDimension, value: string) => {
18
+ if (!['path', 'event', 'country', 'region', 'city'].includes(dimension)) return;
19
+ onFilter({
20
+ ...filters,
21
+ [dimension]: value,
22
+ ...(dimension === 'country'
23
+ ? { region: '', city: '' }
24
+ : dimension === 'region'
25
+ ? { city: '' }
26
+ : {}),
27
+ });
28
+ };
29
+ const groups = (dimensions: RankingDimension[]) =>
30
+ dimensions.map((dimension) => ({
31
+ dimension,
32
+ rows: report.breakdowns[dimension],
33
+ }));
34
+ const properties = Object.keys(report.breakdowns).filter((d): d is `property:${string}` =>
35
+ d.startsWith('property:'),
36
+ );
37
+ return (
38
+ <div className="min-w-0 space-y-6">
39
+ <section aria-label={t(keys.analytics.ui.overview)} className="border-b pb-6">
40
+ <div className="grid grid-cols-2 gap-x-6 gap-y-5 lg:grid-cols-4">
41
+ {(['pageviews', 'visitors', 'sessions', 'events'] as const).map((metric) => (
42
+ <div key={metric} className="min-w-0">
43
+ <p className="text-sm text-muted-foreground">{t(keys.analytics[metric])}</p>
44
+ <p className="mt-1 break-words text-3xl font-semibold tabular-nums sm:text-4xl">
45
+ {report.totals[metric].toLocaleString(locale)}
46
+ </p>
47
+ </div>
48
+ ))}
49
+ </div>
50
+ <p className="mt-4 text-xs leading-relaxed text-muted-foreground">
51
+ {t(keys.analytics.estimates)}
52
+ </p>
53
+ </section>
54
+ <TrafficChart series={report.series} />
55
+ <div className="grid min-w-0 gap-5 lg:grid-cols-2">
56
+ <RankingPanel
57
+ title={t(keys.analytics.dimensions.path)}
58
+ groups={groups(['path'])}
59
+ onFilter={choose}
60
+ />
61
+ <RankingPanel
62
+ title={t(keys.analytics.ui.sources)}
63
+ groups={groups(['referrer', 'utm_source', 'utm_medium', 'utm_campaign'])}
64
+ onFilter={choose}
65
+ />
66
+ <RankingPanel
67
+ title={t(keys.analytics.ui.audience)}
68
+ groups={groups(['browser', 'os', 'device'])}
69
+ onFilter={choose}
70
+ />
71
+ <RankingPanel
72
+ title={t(keys.analytics.geo_title)}
73
+ help={t(keys.analytics.geo_approximate)}
74
+ groups={groups(['country', 'region', 'city'])}
75
+ onFilter={choose}
76
+ />
77
+ <RankingPanel
78
+ title={t(keys.analytics.dimensions.event)}
79
+ groups={groups(['event', ...properties])}
80
+ onFilter={choose}
81
+ />
82
+ <RecentActivity recent={report.recent} />
83
+ </div>
84
+ </div>
85
+ );
86
+ }