feat: add PostHog analytics integration

- Add PostHog client configuration in ui/lib/posthog.ts
- Integrate PostHog tracking in auth forms and provider workflows
- Add PostHog dependencies (posthog-js and posthog-node)
- Update Next.js config for PostHog integration
- Add environment variables for PostHog configuration
- Update changelog with PostHog integration entry
This commit is contained in:
Amit Sharma committed 2025-07-23 15:08:21 -07:00
1 parent aa843b823c
commit 8a65efa441
9 files changed
+73 -5

No files matched your search

@@ -5,6 +5,7 @@ import { Icon } from "@iconify/react";
import { Checkbox } from "@nextui-org/react";
import Link from "next/link";
import { useRouter } from "next/navigation";
import posthog from "posthog-js";
import { useState } from "react";
import { useForm } from "react-hook-form";
import { z } from "zod";
@@ -145,6 +146,13 @@ export const TestConnectionForm = ({
});
} else {
setIsRedirecting(true);
// Capture PostHog event for successful cloud connection
posthog.capture("cloud_connection_success", {
provider_type: providerType,
provider_alias: providerData.data.attributes.alias,
scan_type: form.watch("runOnce") ? "single" : "scheduled",
timestamp: Date.now(),
});
router.push("/scans");
}
} catch (error) {