Skip to content

Commit 8910c03

Browse files
chore: add docs links
Signed-off-by: Henry <mail@henrygressmann.de>
1 parent ec67e07 commit 8910c03

3 files changed

Lines changed: 81 additions & 21 deletions

File tree

web/src/components/project/project.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@ export const ProjectHeader = ({ project, stats }: { stats?: StatsResponse; proje
1515
{project.public ? null : <LockIcon size={16} />}
1616
{project.displayName}
1717
</CardLink>
18-
&nbsp;
19-
{role === "admin" && (
20-
<a href={`/settings/projects/${project.id}`} className={styles.settingsButton} aria-label="Project settings">
21-
<SettingsIcon size={16} />
22-
</a>
23-
)}
2418
</span>
2519
{stats && <LiveVisitorCount count={stats.currentVisitors} />}
2620
</h1>

web/src/components/settings/collection.tsx

Lines changed: 53 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ type CollectionTab = "tracking" | "filters" | "purging";
2727
const title = (value: string) => value.replaceAll("_", " ").replace(/\b\w/g, (char) => char.toUpperCase());
2828
const formatCount = new Intl.NumberFormat().format;
2929
const ingestDimensions = ["event", ...dimensions] as const;
30+
const docsUrl = (hash: string) => `https://liwan.dev/collected-data/#${hash}`;
3031

3132
const isOneOf = <T extends string>(values: readonly T[], value: string): value is T =>
3233
values.some((item) => item === value);
@@ -64,6 +65,12 @@ const ingestFilterOptions: Record<string, FilterOption> = {
6465
...filterOptions,
6566
};
6667

68+
export const DocsLink = ({ hash }: { hash: string }) => (
69+
<a href={docsUrl(hash)} target="_blank" rel="noopener noreferrer">
70+
Learn more.
71+
</a>
72+
);
73+
6774
export const VisitorModeSelect = ({
6875
id,
6976
value,
@@ -143,12 +150,12 @@ export const FiltersEditor = ({
143150
{scope === "entity" ? (
144151
<p>
145152
Global drop rules still apply to this entity. Rules added here are extra rules for this entity only. Inside one
146-
rule, all filters must match. Matching any rule drops the event.
153+
rule, all filters must match. Matching any rule drops the event. <DocsLink hash="drop-rules" />
147154
</p>
148155
) : (
149156
<p>
150157
Events are dropped before they are stored when they match a rule. Inside one rule, all filters must match.
151-
Multiple rules are checked separately, so matching any rule drops the event.
158+
Multiple rules are checked separately, so matching any rule drops the event. <DocsLink hash="drop-rules" />
152159
</p>
153160
)}
154161
{rules.length === 0 ? (
@@ -290,14 +297,27 @@ export const CollectionSettingsPage = () => {
290297
<div className={styles.page}>
291298
<SettingsHeader
292299
title="Collection"
293-
description="Global defaults for collection and retention. Entity settings can override these per source."
300+
description={
301+
<>
302+
Global defaults for collection and retention. Entity settings can override these per source. See also{" "}
303+
<a href="https://liwan.dev/guides/cookie-banners/" target="_blank" rel="noopener noreferrer">
304+
cookie banner considerations
305+
</a>
306+
.
307+
</>
308+
}
294309
/>
295310
<SettingsForm id="collection-settings-form">
296311
<SettingsTabs value={tab} onValueChange={setTab} tabs={collectionTabItems}>
297312
<SettingsPanel value="tracking">
298313
<SettingsField
299314
label="Visitor grouping"
300-
description="Controls how repeat visits are grouped without storing raw IP addresses."
315+
description={
316+
<>
317+
Controls how repeat visits are grouped without storing raw IP addresses.{" "}
318+
<DocsLink hash="visitor-grouping" />
319+
</>
320+
}
301321
name="visitorGroupMode"
302322
>
303323
<VisitorModeSelect
@@ -312,7 +332,11 @@ export const CollectionSettingsPage = () => {
312332
</SettingsField>
313333
<SettingsField
314334
label="Geolocation detail"
315-
description="Choose how much location data is stored for new events."
335+
description={
336+
<>
337+
Choose how much location data is stored for new events. <DocsLink hash="geolocation" />
338+
</>
339+
}
316340
name="trackGeo"
317341
>
318342
<GeoSelect
@@ -328,7 +352,11 @@ export const CollectionSettingsPage = () => {
328352
<SettingsSwitch
329353
name="trackSessions"
330354
label="Track session metrics"
331-
description="Required for bounce rate, time on site, entry URL, and exit URL."
355+
description={
356+
<>
357+
Required for bounce rate, time on site, entry URL, and exit URL. <DocsLink hash="session-metrics" />
358+
</>
359+
}
332360
checked={trackSessions}
333361
onCheckedChange={(checked) => {
334362
setTrackSessions(checked);
@@ -338,7 +366,12 @@ export const CollectionSettingsPage = () => {
338366
<SettingsSwitch
339367
name="trackUtmParams"
340368
label="Track UTM parameters"
341-
description="Stores campaign fields like source, medium, campaign, term, and content."
369+
description={
370+
<>
371+
Stores campaign fields like source, medium, campaign, term, and content.{" "}
372+
<DocsLink hash="utm-parameters" />
373+
</>
374+
}
342375
checked={trackUtmParams}
343376
onCheckedChange={(checked) => {
344377
setTrackUtmParams(checked);
@@ -355,7 +388,12 @@ export const CollectionSettingsPage = () => {
355388
<SettingsPanel value="purging">
356389
<SettingsField
357390
label="History retention"
358-
description="Automatically prune older event data after the selected period."
391+
description={
392+
<>
393+
Automatically prune older event data after the selected period.{" "}
394+
<DocsLink hash="retention-and-pruning" />
395+
</>
396+
}
359397
name="historyRetention"
360398
>
361399
<select
@@ -384,7 +422,13 @@ export const CollectionSettingsPage = () => {
384422
</SettingsField>
385423
<SettingsFieldset
386424
legend="Prune Data"
387-
description="Pruning applies saved retention, UTM, geolocation, and session settings to historical data. Ingest filters only affect new events. Settings save automatically; run a dry run to preview."
425+
description={
426+
<>
427+
Pruning applies saved retention, UTM, geolocation, and session settings to historical data. Drop rules
428+
only affect new events. Settings save automatically; run a dry run to preview.{" "}
429+
<DocsLink hash="retention-and-pruning" />
430+
</>
431+
}
388432
>
389433
<div className={styles.pruneActions}>
390434
<button type="button" className="secondary outline" onClick={() => prune(true)}>

web/src/components/settings/resource-pages.tsx

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
} from "../../api";
2020
import { createToast } from "../toast";
2121
import { type Tag, Tags } from "../tags";
22-
import { FiltersEditor, GeoSelect, VisitorModeSelect } from "./collection";
22+
import { DocsLink, FiltersEditor, GeoSelect, VisitorModeSelect } from "./collection";
2323
import { DeleteDialog } from "./dialogs";
2424
import { SettingsField, SettingsFieldset, SettingsForm, SettingsHeader, SettingsPanel, SettingsTabs } from "./form";
2525
import styles from "./resource-pages.module.css";
@@ -479,7 +479,11 @@ const EntitySettingsContent = ({ entityId }: { entityId: string }) => {
479479
<SettingsPanel value="collection">
480480
<SettingsField
481481
label="Visitor grouping"
482-
description="Controls how repeat visits are grouped for this entity."
482+
description={
483+
<>
484+
Controls how repeat visits are grouped for this entity. <DocsLink hash="visitor-grouping" />
485+
</>
486+
}
483487
name="visitorGroupMode"
484488
>
485489
<VisitorModeSelect
@@ -494,7 +498,11 @@ const EntitySettingsContent = ({ entityId }: { entityId: string }) => {
494498
</SettingsField>
495499
<SettingsField
496500
label="Session metrics"
497-
description="Required for bounce rate, time on site, entry URL, and exit URL."
501+
description={
502+
<>
503+
Required for bounce rate, time on site, entry URL, and exit URL. <DocsLink hash="session-metrics" />
504+
</>
505+
}
498506
name="trackSessions"
499507
>
500508
<select
@@ -513,7 +521,12 @@ const EntitySettingsContent = ({ entityId }: { entityId: string }) => {
513521
</SettingsField>
514522
<SettingsField
515523
label="UTM parameters"
516-
description="Stores campaign fields like source, medium, campaign, term, and content."
524+
description={
525+
<>
526+
Stores campaign fields like source, medium, campaign, term, and content.{" "}
527+
<DocsLink hash="utm-parameters" />
528+
</>
529+
}
517530
name="trackUtmParams"
518531
>
519532
<select
@@ -532,7 +545,11 @@ const EntitySettingsContent = ({ entityId }: { entityId: string }) => {
532545
</SettingsField>
533546
<SettingsField
534547
label="Geolocation detail"
535-
description="Choose how much location data is stored for this entity."
548+
description={
549+
<>
550+
Choose how much location data is stored for this entity. <DocsLink hash="geolocation" />
551+
</>
552+
}
536553
name="trackGeo"
537554
>
538555
<GeoSelect
@@ -547,7 +564,12 @@ const EntitySettingsContent = ({ entityId }: { entityId: string }) => {
547564
</SettingsField>
548565
<SettingsField
549566
label="History retention"
550-
description="Automatically prune older event data after the selected period."
567+
description={
568+
<>
569+
Automatically prune older event data after the selected period.{" "}
570+
<DocsLink hash="retention-and-pruning" />
571+
</>
572+
}
551573
name="historyRetention"
552574
>
553575
<select

0 commit comments

Comments
 (0)