Skip to main content
Glama
posthog.ts1.05 kB
import posthog, { CaptureOptions, Properties } from "posthog-js"; if (!import.meta.env.SSR && import.meta.env.VITE_POSTHOG_PUBLIC_KEY) { posthog.init(import.meta.env.VITE_POSTHOG_PUBLIC_KEY, { api_host: import.meta.env.VITE_POSTHOG_API_HOST, }); // eslint-disable-next-line @typescript-eslint/no-explicit-any if (typeof window !== "undefined") (window as any).posthog = posthog; } // small wrapper makes it easier to swap things later, // calls multiple tracking platforms, or transform data for different platforms export const tracker = { identify: posthog.identify, alias: posthog.alias, trackEvent( eventName: string, properties?: Properties, options?: CaptureOptions, ) { if (import.meta.env.VITE_DISABLE_TRACKING) { // eslint-disable-next-line no-console console.log("TRACK EVENT", `ap-${eventName}`, properties, options); return; } // add consistent prefix for all events coming from this part of the stack posthog.capture(`ap-${eventName}`, properties, options); }, };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/systeminit/si'

If you have feedback or need assistance with the MCP directory API, please join our Discord server