From bcd97300f0b56975d2130345a628c8c74e6d2217 Mon Sep 17 00:00:00 2001 From: Ashesh <3626859+Ashesh3@users.noreply.github.com> Date: Tue, 31 Oct 2023 12:50:41 +0530 Subject: [PATCH] Track patient card button clicks (#6521) * Track patient card button clicks * Add null check --- src/Components/Patient/PatientInfoCard.tsx | 27 ++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/Components/Patient/PatientInfoCard.tsx b/src/Components/Patient/PatientInfoCard.tsx index 1392b7af6eb..fd6213d8e08 100644 --- a/src/Components/Patient/PatientInfoCard.tsx +++ b/src/Components/Patient/PatientInfoCard.tsx @@ -8,7 +8,7 @@ import { TELEMEDICINE_ACTIONS, } from "../../Common/constants"; import { ConsultationModel, PatientCategory } from "../Facility/models"; -import { Switch } from "@headlessui/react"; +import { Switch, Menu } from "@headlessui/react"; import { Link } from "raviger"; import { useState } from "react"; @@ -26,8 +26,9 @@ import Beds from "../Facility/Consultations/Beds"; import { PatientModel } from "./models"; import request from "../../Utils/request/request.js"; import routes from "../../Redux/api.js"; -import { Menu } from "@headlessui/react"; import DropdownMenu from "../Common/components/Menu.js"; +import { triggerGoal } from "../../Integrations/Plausible.js"; +import useAuthUser from "../../Common/hooks/useAuthUser.js"; export default function PatientInfoCard(props: { patient: PatientModel; @@ -36,6 +37,8 @@ export default function PatientInfoCard(props: { consultationId: string; showAbhaProfile?: boolean; }) { + const authUser = useAuthUser(); + const [open, setOpen] = useState(false); const [showLinkABHANumber, setShowLinkABHANumber] = useState(false); const [showABHAProfile, setShowABHAProfile] = useState( @@ -459,6 +462,11 @@ export default function PatientInfoCard(props: { }); setOpen(true); } + triggerGoal("Patient Card Button Clicked", { + buttonName: action[1], + consultationId: consultation?.id, + userId: authUser?.id, + }); }} > { close(); setShowABHAProfile(true); + triggerGoal("Patient Card Button Clicked", { + buttonName: "Show ABHA Profile", + consultationId: consultation?.id, + userId: authUser?.id, + }); }} > @@ -497,6 +510,11 @@ export default function PatientInfoCard(props: {
{ + triggerGoal("Patient Card Button Clicked", { + buttonName: "Link Care Context", + consultationId: consultation?.id, + userId: authUser?.id, + }); close(); setShowLinkCareContext(true); }} @@ -532,6 +550,11 @@ export default function PatientInfoCard(props: { { + triggerGoal("Patient Card Button Clicked", { + buttonName: "Medico Legal Case", + consultationId: consultation?.id, + userId: authUser?.id, + }); setMedicoLegalCase(checked); switchMedicoLegalCase(checked); }}