export async function capturePostHogEvent(
key: string,
distinct_id: string,
event_name: string,
properties: object = {},
host: string = "https://app.posthog.com",
) {
const { PostHog } = await import("npm:posthog-node");
const client = new PostHog(key, {
host: host,
});
client.capture({
distinctId: distinct_id,
event: event_name,
properties: properties,
});
client.on("error", (err) => {
console.log(err);
});
await client.shutdown();
return "Event captured";
}