Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

feat: add better identifiers to posthog

Marc Seitz9c94a2fe0276
diff --git a/components/documents/add-document-modal.tsx b/components/documents/add-document-modal.tsx
index 4c63c372..76f1e786 100644
--- a/components/documents/add-document-modal.tsx
+++ b/components/documents/add-document-modal.tsx
@@ -167,6 +167,10 @@ export function AddDocumentModal({
type: document.type,
teamId: teamId,
dataroomId: dataroomId,
+ $set: {
+ teamId: teamId,
+ teamPlan: plan,
+ },
});
return;
@@ -184,6 +188,10 @@ export function AddDocumentModal({
path: router.asPath,
type: document.type,
teamId: teamId,
+ $set: {
+ teamId: teamId,
+ teamPlan: plan,
+ },
});
// redirect to the document page
@@ -199,6 +207,10 @@ export function AddDocumentModal({
type: document.type,
newVersion: true,
teamId: teamId,
+ $set: {
+ teamId: teamId,
+ teamPlan: plan,
+ },
});
toast.success("New document version uploaded.");
@@ -337,6 +349,10 @@ export function AddDocumentModal({
type: "notion",
teamId: teamId,
dataroomId: dataroomId,
+ $set: {
+ teamId: teamId,
+ teamPlan: plan,
+ },
});
return;
@@ -357,6 +373,10 @@ export function AddDocumentModal({
path: router.asPath,
type: "notion",
teamId: teamId,
+ $set: {
+ teamId: teamId,
+ teamPlan: plan,
+ },
});
// redirect to the document page
diff --git a/components/providers/posthog-provider.tsx b/components/providers/posthog-provider.tsx
index 1a3ac566..094fc2ae 100644
--- a/components/providers/posthog-provider.tsx
+++ b/components/providers/posthog-provider.tsx
@@ -30,6 +30,10 @@ export const PostHogCustomProvider = ({
posthog.identify(
(session.user as CustomUser).email ??
(session.user as CustomUser).id,
+ {
+ email: (session.user as CustomUser).email,
+ userId: (session.user as CustomUser).id,
+ },
);
} else {
posthog.reset();
diff --git a/components/upload-zone.tsx b/components/upload-zone.tsx
index 7128eeb1..3ca85ae4 100644
--- a/components/upload-zone.tsx
+++ b/components/upload-zone.tsx
@@ -333,6 +333,10 @@ export default function UploadZone({
teamId: teamInfo?.currentTeam?.id,
bulkupload: true,
dataroomId: dataroomId,
+ $set: {
+ teamId: teamInfo?.currentTeam?.id,
+ teamPlan: plan,
+ },
});
return document;