few changes

This commit is contained in:
2025-08-18 14:50:38 -05:00
parent 447af46fa0
commit 5fbd696ad0
4 changed files with 36 additions and 62 deletions

View File

@@ -1,23 +1,23 @@
// pages/api/track.js
import { PostHogClient } from "@/lib/posthog";
export default async function handler(req, res) {
const posthog = PostHogClient();
try {
const { event, properties, distinctId } = req.body;
await posthog.capture({
distinctId: distinctId || "server_event",
event: event || "default_event",
properties: properties || {},
});
await posthog.shutdown();
return res.status(200).json({ success: true });
} catch (error) {
console.error("PostHog error:", error);
return res.status(500).json({ success: false, error: error.message });
}
}
// pages/api/track.js
import { PostHogClient } from "@/lib/posthog";
export default async function handler(req, res) {
const posthog = PostHogClient();
try {
const { event, properties, distinctId } = req.body;
await posthog.capture({
distinctId: distinctId || "server_event",
event: event || "default_event",
properties: properties || {},
});
await posthog.shutdown();
return res.status(200).json({ success: true });
} catch (error) {
console.error("PostHog error:", error);
return res.status(500).json({ success: false, error: error.message });
}
}