mirror of
https://github.com/formbricks/formbricks.git
synced 2026-05-06 11:20:56 -05:00
fix: add onboarding tracking (#2169)
This commit is contained in:
@@ -19,25 +19,29 @@ export default function PosthogIdentify({
|
||||
userTargetingBillingStatus,
|
||||
}: {
|
||||
session: Session;
|
||||
environmentId: string;
|
||||
teamId: string;
|
||||
teamName: string;
|
||||
inAppSurveyBillingStatus: TSubscriptionStatus;
|
||||
linkSurveyBillingStatus: TSubscriptionStatus;
|
||||
userTargetingBillingStatus: TSubscriptionStatus;
|
||||
environmentId?: string;
|
||||
teamId?: string;
|
||||
teamName?: string;
|
||||
inAppSurveyBillingStatus?: TSubscriptionStatus;
|
||||
linkSurveyBillingStatus?: TSubscriptionStatus;
|
||||
userTargetingBillingStatus?: TSubscriptionStatus;
|
||||
}) {
|
||||
const posthog = usePostHog();
|
||||
|
||||
useEffect(() => {
|
||||
if (posthogEnabled && session.user && posthog) {
|
||||
posthog.identify(session.user.id, { name: session.user.name, email: session.user.email });
|
||||
posthog.group("environment", environmentId, { name: environmentId });
|
||||
posthog.group("team", teamId, {
|
||||
name: teamName,
|
||||
inAppSurveyBillingStatus,
|
||||
linkSurveyBillingStatus,
|
||||
userTargetingBillingStatus,
|
||||
});
|
||||
if (environmentId) {
|
||||
posthog.group("environment", environmentId, { name: environmentId });
|
||||
}
|
||||
if (teamId) {
|
||||
posthog.group("team", teamId, {
|
||||
name: teamName,
|
||||
inAppSurveyBillingStatus,
|
||||
linkSurveyBillingStatus,
|
||||
userTargetingBillingStatus,
|
||||
});
|
||||
}
|
||||
}
|
||||
}, [
|
||||
posthog,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import PosthogIdentify from "@/app/(app)/environments/[environmentId]/components/PosthogIdentify";
|
||||
import { getServerSession } from "next-auth";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
@@ -12,6 +13,7 @@ export default async function EnvironmentLayout({ children }) {
|
||||
|
||||
return (
|
||||
<div className="h-full w-full bg-slate-50">
|
||||
<PosthogIdentify session={session} />
|
||||
<ToasterClient />
|
||||
{children}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user