/** * Maps page view facts onto the Umami /api/send contract. * A page view is an unnamed event: no `name`, no `data`. * The client identity (user agent, IP) travels as request headers, not in * the payload — see src/analytics/recordPageviewToUmami.ts. */ import type { PageviewFacts } from "./pageview-decision"; export type UmamiSendBody = { readonly type: "event"; readonly payload: { readonly website: string; readonly hostname: string; readonly language: string; readonly referrer: string; readonly url: string; }; }; export function buildUmamiPageviewBody( facts: PageviewFacts, websiteId: string, ): UmamiSendBody { return { type: "event", payload: { website: websiteId, hostname: facts.hostname, language: facts.language, referrer: facts.referrer, url: facts.url, }, }; }