📈(backend) capture an event when a document is imported

We want to capture an event when a file is imported. We add in the
properties the type of file imported and if it is in the
create-for-owner api call.
This commit is contained in:
Manuel Raynaud
2026-06-01 17:41:56 +02:00
parent d1476024a7
commit a05de21d14
7 changed files with 291 additions and 116 deletions
+6
View File
@@ -755,6 +755,12 @@ class DocumentViewSet(
serializer.validated_data["content"] = converted_content
serializer.validated_data["title"] = uploaded_file.name
logger.info("conversion ended successfully")
posthog_capture(
PosthogEventName.DOC_IMPORTED,
self.request.user,
{"content_type": uploaded_file.content_type},
)
except ConversionError as err:
logger.error("could not convert file content with error: %s", err)
raise drf.exceptions.ValidationError(