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
|
|
@ -7,8 +7,8 @@ export interface ITrackEventStore {
|
|||
setTrackElement: (element: string) => void;
|
||||
postHogEventTracker: (
|
||||
eventName: string,
|
||||
payload: object | [] | null
|
||||
// group: { isGrouping: boolean; groupType: string; gorupId: string } | null
|
||||
payload: object | [] | null,
|
||||
group?: { isGrouping: boolean | null; groupType: string | null; gorupId: string | null } | null
|
||||
) => void;
|
||||
}
|
||||
|
||||
|
|
@ -30,8 +30,8 @@ export class TrackEventStore implements ITrackEventStore {
|
|||
|
||||
postHogEventTracker = (
|
||||
eventName: string,
|
||||
payload: object | [] | null
|
||||
// group: { isGrouping: boolean; groupType: string; gorupId: string } | null
|
||||
payload: object | [] | null,
|
||||
group?: { isGrouping: boolean | null; groupType: string | null; gorupId: string | null } | null
|
||||
) => {
|
||||
try {
|
||||
console.log("POSTHOG_EVENT: ", eventName);
|
||||
|
|
@ -43,7 +43,7 @@ export class TrackEventStore implements ITrackEventStore {
|
|||
project_id: this.rootStore.project.currentProjectDetails?.id ?? "",
|
||||
project_identifier: this.rootStore.project.currentProjectDetails?.identifier ?? "",
|
||||
};
|
||||
if (["PROJECT_CREATE", "PROJECT_UPDATE"].includes(eventName)) {
|
||||
if (["PROJECT_CREATED", "PROJECT_UPDATED"].includes(eventName)) {
|
||||
const project_details: any = payload as object;
|
||||
extras = {
|
||||
...extras,
|
||||
|
|
@ -53,24 +53,23 @@ export class TrackEventStore implements ITrackEventStore {
|
|||
};
|
||||
}
|
||||
|
||||
// if (group!.isGrouping === true) {
|
||||
// posthog?.group(group!.groupType, group!.gorupId, {
|
||||
// name: "PostHog",
|
||||
// subscription: "subscription",
|
||||
// date_joined: "2020-01-23T00:00:00.000Z",
|
||||
// });
|
||||
// console.log("END OF GROUPING");
|
||||
// posthog?.capture(eventName, {
|
||||
// ...payload,
|
||||
// element: this.trackElement ?? "",
|
||||
// });
|
||||
// } else {
|
||||
posthog?.capture(eventName, {
|
||||
...payload,
|
||||
extras: extras,
|
||||
element: this.trackElement ?? "",
|
||||
});
|
||||
// }
|
||||
if (group && group!.isGrouping === true) {
|
||||
posthog?.group(group!.groupType!, group!.gorupId!, {
|
||||
date: new Date(),
|
||||
workspace_id: group!.gorupId,
|
||||
});
|
||||
posthog?.capture(eventName, {
|
||||
...payload,
|
||||
extras: extras,
|
||||
element: this.trackElement ?? "",
|
||||
});
|
||||
} else {
|
||||
posthog?.capture(eventName, {
|
||||
...payload,
|
||||
extras: extras,
|
||||
element: this.trackElement ?? "",
|
||||
});
|
||||
}
|
||||
console.log(payload);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue