Skip to content

Commit c80b85c

Browse files
committed
fix: fix organization data tracking
1 parent 9448f23 commit c80b85c

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

studio/src/lib/track.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,26 @@ const identify = ({
5959
// with the right data
6060
posthog.reset();
6161
} else if (distinctId === email) {
62-
// This session has been already identified, nothing to do!
62+
// This session has been already identified, just keep the organization synchronized!
63+
posthog.group('cosmo_organization', organizationId, {
64+
id: organizationId,
65+
slug: organizationSlug,
66+
name: organizationName,
67+
plan: plan
68+
});
6369
return;
6470
}
6571

6672
posthog.identify(email, {
6773
id,
6874
email,
69-
organizationId,
70-
organizationName,
71-
organizationSlug,
72-
plan,
7375
});
74-
posthog.group('orgslug', organizationSlug);
76+
posthog.group('cosmo_organization', organizationId, {
77+
id: organizationId,
78+
slug: organizationSlug,
79+
name: organizationName,
80+
plan: plan
81+
});
7582
};
7683

7784
export { resetTracking, identify };

0 commit comments

Comments
 (0)