chore: posthog event for workspace invite (#2989)
* chore: posthog event for workspace invite * chore: updated event names, added all the existing events to workspace metrics group * chore: seperated workspace invite * fix: workspace invite accept event updated --------- Co-authored-by: Ramesh Kumar Chandra <rameshkumar2299@gmail.com>
This commit is contained in:
parent
37c03ff239
commit
b35874e294
25 changed files with 441 additions and 120 deletions
|
|
@ -41,7 +41,7 @@ const WorkspaceMembersSettingsPage: NextPageWithLayout = observer(() => {
|
|||
return inviteMembersToWorkspace(workspaceSlug.toString(), data)
|
||||
.then(async (res) => {
|
||||
setInviteModal(false);
|
||||
postHogEventTracker("WORKSPACE_USER_INVITE", { ...res, state: "SUCCESS" });
|
||||
postHogEventTracker("MEMBER_INVITED", { ...res, state: "SUCCESS" });
|
||||
setToastAlert({
|
||||
type: "success",
|
||||
title: "Success!",
|
||||
|
|
@ -49,7 +49,7 @@ const WorkspaceMembersSettingsPage: NextPageWithLayout = observer(() => {
|
|||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
postHogEventTracker("WORKSPACE_USER_INVITE", { state: "FAILED" });
|
||||
postHogEventTracker("MEMBER_INVITED", { state: "FAILED" });
|
||||
setToastAlert({
|
||||
type: "error",
|
||||
title: "Error!",
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ const UserInvitationsPage: NextPageWithLayout = observer(() => {
|
|||
const {
|
||||
workspace: { workspaceSlug },
|
||||
user: { currentUserSettings },
|
||||
trackEvent: { postHogEventTracker }
|
||||
} = useMobxStore();
|
||||
|
||||
const router = useRouter();
|
||||
|
|
@ -88,10 +89,18 @@ const UserInvitationsPage: NextPageWithLayout = observer(() => {
|
|||
|
||||
workspaceService
|
||||
.joinWorkspaces({ invitations: invitationsRespond })
|
||||
.then(() => {
|
||||
.then((res) => {
|
||||
mutate("USER_WORKSPACES");
|
||||
const firstInviteId = invitationsRespond[0];
|
||||
const redirectWorkspace = invitations?.find((i) => i.id === firstInviteId)?.workspace;
|
||||
postHogEventTracker(
|
||||
"MEMBER_ACCEPTED",
|
||||
{
|
||||
...res,
|
||||
state: "SUCCESS",
|
||||
accepted_from: "App"
|
||||
}
|
||||
);
|
||||
userService
|
||||
.updateUser({ last_workspace_id: redirectWorkspace?.id })
|
||||
.then(() => {
|
||||
|
|
@ -147,11 +156,10 @@ const UserInvitationsPage: NextPageWithLayout = observer(() => {
|
|||
return (
|
||||
<div
|
||||
key={invitation.id}
|
||||
className={`flex cursor-pointer items-center gap-2 border py-5 px-3.5 rounded ${
|
||||
isSelected
|
||||
className={`flex cursor-pointer items-center gap-2 border py-5 px-3.5 rounded ${isSelected
|
||||
? "border-custom-primary-100"
|
||||
: "border-custom-border-200 hover:bg-custom-background-80"
|
||||
}`}
|
||||
}`}
|
||||
onClick={() => handleInvitation(invitation, isSelected ? "withdraw" : "accepted")}
|
||||
>
|
||||
<div className="flex-shrink-0">
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ const OnboardingPage: NextPageWithLayout = observer(() => {
|
|||
const {
|
||||
user: { currentUser, updateCurrentUser, updateUserOnBoard },
|
||||
workspace: workspaceStore,
|
||||
trackEvent: { postHogEventTracker }
|
||||
} = useMobxStore();
|
||||
const router = useRouter();
|
||||
|
||||
|
|
@ -77,7 +78,19 @@ const OnboardingPage: NextPageWithLayout = observer(() => {
|
|||
const finishOnboarding = async () => {
|
||||
if (!user || !workspaces) return;
|
||||
|
||||
await updateUserOnBoard();
|
||||
await updateUserOnBoard().then(() => {
|
||||
postHogEventTracker(
|
||||
"USER_ONBOARDING_COMPLETE",
|
||||
{
|
||||
user_role: user.role,
|
||||
email: user.email,
|
||||
user_id: user.id,
|
||||
status: "SUCCESS"
|
||||
}
|
||||
)
|
||||
}).catch((error) => {
|
||||
console.log(error);
|
||||
})
|
||||
|
||||
router.replace(`/${workspaces[0].slug}`);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue