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
|
|
@ -66,7 +66,8 @@ export const CreateProjectModal: FC<Props> = observer((props) => {
|
|||
const {
|
||||
project: projectStore,
|
||||
workspaceMember: { workspaceMembers },
|
||||
trackEvent: { postHogEventTracker }
|
||||
trackEvent: { postHogEventTracker },
|
||||
workspace: { currentWorkspace },
|
||||
} = useMobxStore();
|
||||
// states
|
||||
const [isChangeInIdentifierRequired, setIsChangeInIdentifierRequired] = useState(true);
|
||||
|
|
@ -135,8 +136,13 @@ export const CreateProjectModal: FC<Props> = observer((props) => {
|
|||
state: "SUCCESS"
|
||||
}
|
||||
postHogEventTracker(
|
||||
"PROJECT_CREATE",
|
||||
"PROJECT_CREATED",
|
||||
newPayload,
|
||||
{
|
||||
isGrouping: true,
|
||||
groupType: "Workspace_metrics",
|
||||
gorupId: res.workspace
|
||||
}
|
||||
)
|
||||
setToastAlert({
|
||||
type: "success",
|
||||
|
|
@ -156,10 +162,15 @@ export const CreateProjectModal: FC<Props> = observer((props) => {
|
|||
message: err.data[key],
|
||||
});
|
||||
postHogEventTracker(
|
||||
"PROJECT_CREATE",
|
||||
"PROJECT_CREATED",
|
||||
{
|
||||
state: "FAILED"
|
||||
},
|
||||
{
|
||||
isGrouping: true,
|
||||
groupType: "Workspace_metrics",
|
||||
gorupId: currentWorkspace?.id!
|
||||
}
|
||||
)
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import { Button, Input } from "@plane/ui";
|
|||
import type { IProject } from "types";
|
||||
// fetch-keys
|
||||
import { useMobxStore } from "lib/mobx/store-provider";
|
||||
import { trackEvent } from "helpers/event-tracker.helper";
|
||||
|
||||
type DeleteProjectModal = {
|
||||
isOpen: boolean;
|
||||
|
|
@ -28,7 +27,7 @@ const defaultValues = {
|
|||
export const DeleteProjectModal: React.FC<DeleteProjectModal> = (props) => {
|
||||
const { isOpen, project, onClose } = props;
|
||||
// store
|
||||
const { project: projectStore } = useMobxStore();
|
||||
const { project: projectStore, workspace: { currentWorkspace }, trackEvent: { postHogEventTracker } } = useMobxStore();
|
||||
// router
|
||||
const router = useRouter();
|
||||
const { workspaceSlug, projectId } = router.query;
|
||||
|
|
@ -63,9 +62,17 @@ export const DeleteProjectModal: React.FC<DeleteProjectModal> = (props) => {
|
|||
if (projectId && projectId.toString() === project.id) router.push(`/${workspaceSlug}/projects`);
|
||||
|
||||
handleClose();
|
||||
trackEvent(
|
||||
'DELETE_PROJECT'
|
||||
)
|
||||
postHogEventTracker(
|
||||
'PROJECT_DELETED',
|
||||
{
|
||||
state: "SUCCESS"
|
||||
},
|
||||
{
|
||||
isGrouping: true,
|
||||
groupType: "Workspace_metrics",
|
||||
gorupId: currentWorkspace?.id!
|
||||
}
|
||||
);
|
||||
setToastAlert({
|
||||
type: "success",
|
||||
title: "Success!",
|
||||
|
|
@ -73,9 +80,17 @@ export const DeleteProjectModal: React.FC<DeleteProjectModal> = (props) => {
|
|||
});
|
||||
})
|
||||
.catch(() => {
|
||||
trackEvent(
|
||||
'DELETE_PROJECT/FAIL'
|
||||
)
|
||||
postHogEventTracker(
|
||||
'PROJECT_DELETED',
|
||||
{
|
||||
state: "FAILED"
|
||||
},
|
||||
{
|
||||
isGrouping: true,
|
||||
groupType: "Workspace_metrics",
|
||||
gorupId: currentWorkspace?.id!
|
||||
}
|
||||
);
|
||||
setToastAlert({
|
||||
type: "error",
|
||||
title: "Error!",
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ const projectService = new ProjectService();
|
|||
export const ProjectDetailsForm: FC<IProjectDetailsForm> = (props) => {
|
||||
const { project, workspaceSlug, isAdmin } = props;
|
||||
// store
|
||||
const { project: projectStore, trackEvent: { postHogEventTracker } } = useMobxStore();
|
||||
const { project: projectStore, trackEvent: { postHogEventTracker }, workspace: { currentWorkspace } } = useMobxStore();
|
||||
// toast
|
||||
const { setToastAlert } = useToast();
|
||||
// form data
|
||||
|
|
@ -63,8 +63,13 @@ export const ProjectDetailsForm: FC<IProjectDetailsForm> = (props) => {
|
|||
.updateProject(workspaceSlug.toString(), project.id, payload)
|
||||
.then((res) => {
|
||||
postHogEventTracker(
|
||||
'PROJECT_UPDATE',
|
||||
{...res, state: "SUCCESS"}
|
||||
'PROJECT_UPDATED',
|
||||
{ ...res, state: "SUCCESS" },
|
||||
{
|
||||
isGrouping: true,
|
||||
groupType: "Workspace_metrics",
|
||||
gorupId: res.workspace
|
||||
}
|
||||
);
|
||||
setToastAlert({
|
||||
type: "success",
|
||||
|
|
@ -74,9 +79,14 @@ export const ProjectDetailsForm: FC<IProjectDetailsForm> = (props) => {
|
|||
})
|
||||
.catch((error) => {
|
||||
postHogEventTracker(
|
||||
'PROJECT_UPDATE',
|
||||
'PROJECT_UPDATED',
|
||||
{
|
||||
state: "FAILED"
|
||||
},
|
||||
{
|
||||
isGrouping: true,
|
||||
groupType: "Workspace_metrics",
|
||||
gorupId: currentWorkspace?.id!
|
||||
}
|
||||
);
|
||||
setToastAlert({
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ export const SendProjectInvitationModal: React.FC<Props> = observer((props) => {
|
|||
user: { currentProjectRole },
|
||||
workspaceMember: { workspaceMembers },
|
||||
trackEvent: { postHogEventTracker },
|
||||
workspace: { currentWorkspace }
|
||||
} = useMobxStore();
|
||||
|
||||
const {
|
||||
|
|
@ -92,16 +93,30 @@ export const SendProjectInvitationModal: React.FC<Props> = observer((props) => {
|
|||
type: "success",
|
||||
message: "Member added successfully",
|
||||
});
|
||||
postHogEventTracker("PROJECT_MEMBER_INVITE", {
|
||||
...res,
|
||||
state: "SUCCESS",
|
||||
});
|
||||
postHogEventTracker("MEMBER_ADDED",
|
||||
{
|
||||
...res,
|
||||
state: "SUCCESS",
|
||||
},
|
||||
{
|
||||
isGrouping: true,
|
||||
groupType: "Workspace_metrics",
|
||||
gorupId: currentWorkspace?.id!
|
||||
}
|
||||
);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
postHogEventTracker("PROJECT_MEMBER_INVITE", {
|
||||
state: "FAILED",
|
||||
});
|
||||
postHogEventTracker("MEMBER_ADDED",
|
||||
{
|
||||
state: "FAILED",
|
||||
},
|
||||
{
|
||||
isGrouping: true,
|
||||
groupType: "Workspace_metrics",
|
||||
gorupId: currentWorkspace?.id!
|
||||
}
|
||||
);
|
||||
})
|
||||
.finally(() => {
|
||||
reset(defaultValues);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue