mirror of
https://github.com/vercel/eve.git
synced 2026-09-20 05:35:39 +08:00
f44e16a3e5
Co-authored-by: Casey Gowrie <ctgowrie@gmail.com> Co-authored-by: Allen Zhou <46854522+allenzhou101@users.noreply.github.com> Co-authored-by: Rui Conti <ruiconti@gmail.com> Co-authored-by: JJ Kasper <jj@jjsweb.site> Co-authored-by: Timo Lins <1440854+timolins@users.noreply.github.com> Co-authored-by: Felix Arntz <3531426+felixarntz@users.noreply.github.com> Co-authored-by: Shar Dara <2982650+darafsheh@users.noreply.github.com> Co-authored-by: John Phamous <johnphammail@gmail.com>
27 lines
775 B
TypeScript
27 lines
775 B
TypeScript
import type { TrackMarkdownRequestEvent } from "@vercel/geistdocs/proxy";
|
|
import { siteId } from "@/geistdocs";
|
|
|
|
const PLATFORM_URL = "https://geistdocs.com/md-tracking";
|
|
|
|
/** Track a markdown page request via the Geistdocs platform. */
|
|
export async function trackMdRequest(event: TrackMarkdownRequestEvent): Promise<void> {
|
|
try {
|
|
const response = await fetch(PLATFORM_URL, {
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
body: JSON.stringify({
|
|
...event,
|
|
siteId: siteId ?? "geistdocs-unknown",
|
|
}),
|
|
});
|
|
|
|
if (!response.ok) {
|
|
console.error("MD tracking failed:", response.status, await response.text());
|
|
}
|
|
} catch (error) {
|
|
console.error("MD tracking error:", error);
|
|
}
|
|
}
|