@@ -27,6 +27,7 @@ type CollectionTab = "tracking" | "filters" | "purging";
2727const title = ( value : string ) => value . replaceAll ( "_" , " " ) . replace ( / \b \w / g, ( char ) => char . toUpperCase ( ) ) ;
2828const formatCount = new Intl . NumberFormat ( ) . format ;
2929const ingestDimensions = [ "event" , ...dimensions ] as const ;
30+ const docsUrl = ( hash : string ) => `https://liwan.dev/collected-data/#${ hash } ` ;
3031
3132const 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+
6774export 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 ) } >
0 commit comments