From 63b70f9291b636c2d36808153e4b8030687425a1 Mon Sep 17 00:00:00 2001 From: Ole Date: Thu, 7 Nov 2024 14:36:29 +0100 Subject: [PATCH] chore: Add tracking to Alert list actions --- .../Components/SavedSearchAlertListItem.tsx | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/Apps/Settings/Routes/SavedSearchAlerts/Components/SavedSearchAlertListItem.tsx b/src/Apps/Settings/Routes/SavedSearchAlerts/Components/SavedSearchAlertListItem.tsx index 886d0ae7222..f08170385d9 100644 --- a/src/Apps/Settings/Routes/SavedSearchAlerts/Components/SavedSearchAlertListItem.tsx +++ b/src/Apps/Settings/Routes/SavedSearchAlerts/Components/SavedSearchAlertListItem.tsx @@ -1,7 +1,9 @@ +import { ActionType } from "@artsy/cohesion" import { Box, Clickable, Flex, Spacer, Sup, Text } from "@artsy/palette" -import { createFragmentContainer, graphql } from "react-relay" import { SavedSearchAlertListItem_item$data } from "__generated__/SavedSearchAlertListItem_item.graphql" import { EditAlertEntity } from "Apps/Settings/Routes/SavedSearchAlerts/types" +import { createFragmentContainer, graphql } from "react-relay" +import { useTracking } from "react-tracking" import { useJump } from "Utils/Hooks/useJump" export type SavedSearchAlertListItemVariant = "active" | "inactive" @@ -19,9 +21,10 @@ export const SavedSearchAlertListItem: React.FC = onEditAlertClick, onViewArtworksClick, }) => { - const matchingArtworksCount = item.artworksConnection?.counts?.total - const { jumpTo } = useJump() + const { trackEvent } = useTracking() + + const matchingArtworksCount = item.artworksConnection?.counts?.total return ( = { - { - onEditAlertClick({ - id: item.internalID, - name: item.settings?.name ?? undefined, - artistIds: item.artistIDs as string[], - }) - jumpTo("Alerts") - } + trackEvent({ + action_type: ActionType.clickedEditAlert, + alert_id: item.internalID, + }) + onEditAlertClick({ + id: item.internalID, + name: item.settings?.name ?? undefined, + artistIds: item.artistIDs as string[], + }) + jumpTo("Alerts") }} > Edit @@ -105,6 +110,10 @@ export const SavedSearchAlertListItem: React.FC = > { + trackEvent({ + action_type: ActionType.clickedViewArtworks, + alert_id: item.internalID, + }) onViewArtworksClick({ id: item.internalID, name: item.settings?.name ?? undefined,