Files
community-rule/lib/umami.ts
T
adilallo d9c475a967 Give finished Rules a print path, folded launch counts, and a two-day follow-up.
Export is PDF, RULE.md, and Print on US Letter, with every shared term, no member names, and a takeaway that points at Ask an organizer. Finished Rules keep type and place so the team can read folded counts without a database, Umami can sit beside the app with no cookies, and the person who holds the pen gets working PDF and RULE.md links 48 hours later.
2026-11-10 18:32:33 -07:00

17 lines
582 B
TypeScript

/**
* Optional Umami tracker. Unset env vars mean no script ships.
* Cookie-free mode is an Umami server setting, not this snippet.
*/
export function umamiTracker(): { src: string; websiteId: string } | null {
const src = process.env.NEXT_PUBLIC_UMAMI_SRC?.trim() ?? "";
const websiteId = process.env.NEXT_PUBLIC_UMAMI_WEBSITE_ID?.trim() ?? "";
if (!src || !websiteId) return null;
try {
const url = new URL(src);
if (url.protocol !== "https:" && url.protocol !== "http:") return null;
return { src: url.href, websiteId };
} catch {
return null;
}
}