From 8610e33e3814c7177b6e2859a29296ece49257d4 Mon Sep 17 00:00:00 2001 From: mattcasey Date: Thu, 5 Dec 2024 16:35:39 -0700 Subject: [PATCH] add quest complete event --- packages/mixpanel/src/interfaces.ts | 3 +++ packages/scoutgame/src/quests/completeQuest.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/packages/mixpanel/src/interfaces.ts b/packages/mixpanel/src/interfaces.ts index f061ec1157..db2ebe5549 100644 --- a/packages/mixpanel/src/interfaces.ts +++ b/packages/mixpanel/src/interfaces.ts @@ -58,6 +58,9 @@ export type MixpanelEventMap = { referralCode: string; referrerPath: string; }; + complete_quest: BaseEvent & { + questType: string; + }; } & Record; export type MixpanelEvent = MixpanelEventMap[keyof MixpanelEventMap]; diff --git a/packages/scoutgame/src/quests/completeQuest.ts b/packages/scoutgame/src/quests/completeQuest.ts index 6b5f38ba72..5642e01db0 100644 --- a/packages/scoutgame/src/quests/completeQuest.ts +++ b/packages/scoutgame/src/quests/completeQuest.ts @@ -1,4 +1,5 @@ import { prisma } from '@charmverse/core/prisma-client'; +import { trackUserAction } from '@packages/mixpanel/trackUserAction'; import { QuestsRecord } from '@packages/scoutgame-ui/components/quests/QuestsList/QuestsRecord'; import { sendPointsForSocialQuest } from '../points/builderEvents/sendPointsForSocialQuest'; @@ -21,4 +22,6 @@ export async function completeQuest(userId: string, questType: string) { points, type: questType }); + + trackUserAction('complete_quest', { userId, questType }); }