Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/analytics/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ export enum AnalyticsEventTypes {
GoodDollarNewsTabSelected = "GoodDollar_News_Tab_Selected",
WalletSignedMessageConfirmed = "Wallet_Message_Signed_Confirmed",
WalletSignedMessageCancelled = "Wallet_Message_Signed_Cancelled",
AICreditsTabSelected = "AICredits_Tab_Selected",
GoodReserveTabSelected = "GoodReserve_Tab_Selected",
SuperfluidCampaignTabSelected = "SuperfluidCampaign_Tab_Selected",
}

export enum AvailableMethodsNames {
Expand Down Expand Up @@ -261,3 +264,12 @@ export type AnalyticsEvent =
chainName: string
methodName: AvailableMethods
}
| {
type: AnalyticsEventTypes.AICreditsTabSelected
}
| {
type: AnalyticsEventTypes.GoodReserveTabSelected
}
| {
type: AnalyticsEventTypes.SuperfluidCampaignTabSelected
}
29 changes: 28 additions & 1 deletion src/sections/Home/components/WalletSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,29 @@ import { postMessageToReactNative } from "@/utils/messageReactNative"
import { isPwa } from "@/utils/pwa"
import {
coreDashboardActions,
type DashboardAction,
widgetDashboardActions,
} from "@/widgets/registry"

import { Menu } from "./Menu"
import { ProfileCard } from "./ProfileCard"
import styles from "./WalletSection.module.css"

// Widget dashboard buttons that should report a click. Core actions
// (Send/Receive/Swap/...) are intentionally excluded - they only track
// action completion, not the click itself.
type WidgetTabSelectedEventType =
| AnalyticsEventTypes.AICreditsTabSelected
| AnalyticsEventTypes.GoodReserveTabSelected
| AnalyticsEventTypes.SuperfluidCampaignTabSelected

const widgetActionEventType: Record<string, WidgetTabSelectedEventType> = {
Comment thread
L03TJ3 marked this conversation as resolved.
"goodwidget.ai-credits": AnalyticsEventTypes.AICreditsTabSelected,
"goodwidget.goodreserve": AnalyticsEventTypes.GoodReserveTabSelected,
"goodwidget.superfluid-campaign":
AnalyticsEventTypes.SuperfluidCampaignTabSelected,
}

export default function WalletSection({
children,
}: {
Expand Down Expand Up @@ -198,7 +214,10 @@ export default function WalletSection({
swap: homeTranslations.swap,
walletconnect: homeTranslations.walletConnect,
}
const dashboardActions = [...coreDashboardActions, ...widgetDashboardActions]
const dashboardActions: readonly DashboardAction[] = [
...coreDashboardActions,
...widgetDashboardActions,
]

return (
<>
Expand Down Expand Up @@ -241,13 +260,21 @@ export default function WalletSection({
: action.id === "walletconnect" && sessions.length > 0
? "connected"
: undefined
const widgetEventType = action.widgetId
? widgetActionEventType[action.widgetId]
: undefined

return (
<Link
key={action.id}
href={`/${locale}/${action.routeSlug}`}
scroll={false}
prefetch={true}
onClick={
widgetEventType
? () => captureEvent({ type: widgetEventType })
: undefined
}
>
<RoundButton
icon={icon}
Expand Down
Loading