update posthog events to also submit form type

This commit is contained in:
Matthias Nannt
2023-02-13 15:13:08 +01:00
parent 52d5bb7c44
commit 8e277e030a
2 changed files with 10 additions and 3 deletions

View File

@@ -109,13 +109,17 @@ export default async function handle(req: NextApiRequest, res: NextApiResponse)
if (submission.finished) {
capturePosthogEvent(form.organisationId, "submission finished", {
formId,
formType: form.type,
});
captureTelemetry("submission finished");
} else {
capturePosthogEvent(form.organisationId, "submission updated", {
formId,
formType: form.type,
});
captureTelemetry("submission updated", {
formType: form.type,
});
captureTelemetry("submission updated");
}
res.json(submissionResult);
}

View File

@@ -94,10 +94,13 @@ export default async function handle(req: NextApiRequest, res: NextApiResponse)
// run pipelines
await runPipelines(pipelineEvents, form, submission, submissionResult);
// tracking
capturePosthogEvent(form.organisationId, "submission received", {
capturePosthogEvent(form.organisationId, "submission created", {
formId,
formType: form.type,
});
captureTelemetry("submission created", {
formType: form.type,
});
captureTelemetry("submission received");
res.json(submissionResult);
}