diff --git a/packages/lib/environment/service.ts b/packages/lib/environment/service.ts index 603b8252e7..201e8e8f2c 100644 --- a/packages/lib/environment/service.ts +++ b/packages/lib/environment/service.ts @@ -17,6 +17,7 @@ import { import { DatabaseError, ResourceNotFoundError, ValidationError } from "@formbricks/types/errors"; import { cache } from "../cache"; import { getOrganizationsByUserId } from "../organization/service"; +import { capturePosthogEnvironmentEvent } from "../posthogServer"; import { getProducts } from "../product/service"; import { validateInputs } from "../utils/validate"; import { environmentCache } from "./cache"; @@ -192,6 +193,10 @@ export const createEnvironment = async ( productId: environment.productId, }); + await capturePosthogEnvironmentEvent(environment.id, "environment created", { + environmentType: environment.type, + }); + return environment; } catch (error) { if (error instanceof Prisma.PrismaClientKnownRequestError) {