This commit is contained in:
24
apps/www/app/_lib/event-taxonomy.ts
Normal file
24
apps/www/app/_lib/event-taxonomy.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Stub event taxonomy for the v3.2 landing per amendment §2.1.
|
||||
*
|
||||
* Logs to console in development; no-op in production. Replace with a real
|
||||
* analytics provider (PostHog / Plausible) in Phase 2.
|
||||
*/
|
||||
|
||||
export interface LandingEvent {
|
||||
readonly name: string;
|
||||
readonly properties?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export const events = {
|
||||
pageView: 'landing.page_view',
|
||||
sectionVisible: 'landing.section_visible',
|
||||
ctaClick: 'landing.cta_click',
|
||||
pricingBillingToggle: 'landing.pricing.billing_toggle.changed',
|
||||
} as const;
|
||||
|
||||
export function emit(event: LandingEvent): void {
|
||||
if (process.env.NODE_ENV === 'production') return;
|
||||
// eslint-disable-next-line no-console
|
||||
console.info('[landing.event]', event.name, event.properties ?? {});
|
||||
}
|
||||
15
apps/www/app/_lib/os-detection.ts
Normal file
15
apps/www/app/_lib/os-detection.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
export type OSId = 'macOS' | 'Windows' | 'Linux';
|
||||
|
||||
/**
|
||||
* Best-effort desktop OS detection from a User-Agent string.
|
||||
*
|
||||
* Mobile/tablet visitors return null so download CTAs stay generic instead of
|
||||
* promising a desktop installer for the wrong platform.
|
||||
*/
|
||||
export function detectOSFromUserAgent(ua: string): OSId | null {
|
||||
if (/iPhone|iPad|iPod|Android|Mobile|Tablet/i.test(ua)) return null;
|
||||
if (/Mac/i.test(ua)) return 'macOS';
|
||||
if (/Windows/i.test(ua)) return 'Windows';
|
||||
if (/Linux/i.test(ua)) return 'Linux';
|
||||
return null;
|
||||
}
|
||||
Reference in New Issue
Block a user