Skip to content

Commit 6c8fe30

Browse files
authored
Merge pull request #13909 from ethereum/staging-homepage-events
Homepage: matomo events
2 parents 743f46a + 2497834 commit 6c8fe30

File tree

7 files changed

+215
-82
lines changed

7 files changed

+215
-82
lines changed

src/components/Buttons/SvgButtonLink.tsx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
11
import { cva, VariantProps } from "class-variance-authority"
2-
import type { FC, ReactNode, SVGProps } from "react"
2+
import type { FC, SVGProps } from "react"
33

44
import { cn } from "@/lib/utils/cn"
55

6-
import { BaseLink } from "../ui/Link"
7-
8-
type SvgButtonLinkProps = {
9-
Svg: FC<SVGProps<SVGElement>>
10-
label?: string
11-
children: ReactNode
12-
href: string
13-
className?: string
14-
size?: number
15-
}
6+
import { BaseLink, LinkProps } from "../ui/Link"
167

178
const variants = cva("flex items-center gap-3.5", {
189
variants: {
@@ -28,14 +19,20 @@ const variants = cva("flex items-center gap-3.5", {
2819

2920
type Variants = VariantProps<typeof variants>
3021

22+
export type SvgButtonLinkProps = LinkProps & {
23+
Svg: FC<SVGProps<SVGElement>>
24+
label?: string
25+
size?: number
26+
} & Variants
27+
3128
const SvgButtonLink = ({
3229
label,
3330
children,
3431
Svg,
3532
className,
3633
variant,
3734
...props
38-
}: SvgButtonLinkProps & Variants) => (
35+
}: SvgButtonLinkProps) => (
3936
<BaseLink
4037
className={cn(
4138
"group rounded-2xl no-underline focus:outline focus:outline-4 focus:outline-offset-8",

src/components/Homepage/BentoCard.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export type BentoCardProps = HTMLAttributes<HTMLDivElement> & {
1717
imgWidth?: number
1818
imgHeight?: number
1919
title: string
20+
eventName: string
2021
}
2122

2223
const BentoCard = ({
@@ -28,6 +29,7 @@ const BentoCard = ({
2829
imgWidth,
2930
imgHeight,
3031
title,
32+
eventName,
3133
}: BentoCardProps) => (
3234
<Card
3335
className={cn(
@@ -43,7 +45,16 @@ const BentoCard = ({
4345
{title}
4446
</CardTitle>
4547
<p className="mb-8 text-md">{children}</p>
46-
<ButtonLink href={href} variant="outline" isSecondary>
48+
<ButtonLink
49+
href={href}
50+
variant="outline"
51+
isSecondary
52+
customEventOptions={{
53+
eventCategory: "Homepage",
54+
eventAction: "use cases",
55+
eventName,
56+
}}
57+
>
4758
{action} <ChevronNext />
4859
</ButtonLink>
4960
</div>

src/components/Homepage/useBentoBox.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type CopyDetails = {
1717
children: string
1818
action: string
1919
href: string
20+
eventName: Category
2021
}
2122

2223
const gradientStops = "from-20% to-60%"
@@ -100,6 +101,7 @@ export const useBentoBox = () => {
100101
children: t(`page-index:page-index-bento-${category}-content`),
101102
action: t(`page-index:page-index-bento-${category}-action`),
102103
href,
104+
eventName: category,
103105
})
104106

105107
return [

src/components/Homepage/useHome.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export const useHome = () => {
5353
),
5454
codeLanguage: "language-solidity",
5555
code: SimpleWalletContent,
56+
eventName: "bank",
5657
},
5758
{
5859
title: t("page-index:page-index-developers-code-example-title-1"),
@@ -61,6 +62,7 @@ export const useHome = () => {
6162
),
6263
codeLanguage: "language-solidity",
6364
code: SimpleTokenContent,
65+
eventName: "token",
6466
},
6567
{
6668
title: t("page-index:page-index-developers-code-example-title-2"),
@@ -69,6 +71,7 @@ export const useHome = () => {
6971
),
7072
codeLanguage: "language-javascript",
7173
code: CreateWalletContent,
74+
eventName: "wallet",
7275
},
7376
{
7477
title: t("page-index:page-index-developers-code-example-title-3"),
@@ -77,6 +80,7 @@ export const useHome = () => {
7780
),
7881
codeLanguage: "language-solidity",
7982
code: SimpleDomainRegistryContent,
83+
eventName: "dns",
8084
},
8185
]
8286

@@ -86,21 +90,24 @@ export const useHome = () => {
8690
description: t("page-index:page-index-cta-wallet-description"),
8791
href: "/wallets/find-wallet/",
8892
Svg: PickWalletIcon,
89-
className: "text-primary hover:text-primary-hover", // TODO: Confirm hover style
93+
className: "text-primary hover:text-primary-hover",
94+
eventName: "find wallet",
9095
},
9196
{
9297
label: t("page-index:page-index-cta-get-eth-label"),
9398
description: t("page-index:page-index-cta-get-eth-description"),
9499
href: "/get-eth/",
95100
Svg: EthTokenIcon,
96101
className: "text-accent-a hover:text-accent-a-hover",
102+
eventName: "get eth",
97103
},
98104
{
99105
label: t("page-index:page-index-cta-networks-label"),
100106
description: t("page-index:page-index-cta-networks-description"),
101107
href: "/layer-2/", // TODO: Update with new networks page when ready
102108
Svg: ChooseNetworkIcon,
103109
className: "text-accent-b hover:text-accent-b-hover",
110+
eventName: "L2",
104111
},
105112
{
106113
label: t("page-index:page-index-cta-dapps-label"),
@@ -111,6 +118,7 @@ export const useHome = () => {
111118
"text-accent-c hover:text-accent-c-hover",
112119
isRtl && "[&_svg]:-scale-x-100"
113120
),
121+
eventName: "dapps",
114122
},
115123
]
116124

@@ -166,27 +174,31 @@ export const useHome = () => {
166174
description: t(
167175
"page-index:page-index-join-action-contribute-description"
168176
),
177+
eventName: "contribute",
169178
},
170179
{
171180
Svg: FaGithub,
172181
label: "GitHub",
173182
href: GITHUB_REPO_URL,
174183
className: "text-accent-a hover:text-accent-a-hover",
175184
description: t("page-index:page-index-join-action-github-description"),
185+
eventName: "GitHub",
176186
},
177187
{
178188
Svg: FaDiscord,
179189
label: "Discord",
180190
href: "/discord/",
181191
className: "text-primary hover:text-primary-hover",
182192
description: t("page-index:page-index-join-action-discord-description"),
193+
eventName: "Discord",
183194
},
184195
{
185196
Svg: FaXTwitter,
186197
label: "X",
187198
href: "https://x.com/EthDotOrg",
188199
className: "text-accent-b hover:text-accent-b-hover",
189200
description: t("page-index:page-index-join-action-twitter-description"),
201+
eventName: "Twitter",
190202
},
191203
]
192204

src/components/ui/card.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { cva, VariantProps } from "class-variance-authority"
33

44
import { cn } from "@/lib/utils/cn"
55

6-
import { BaseLink } from "./Link"
6+
import { BaseLink, LinkProps } from "./Link"
77

88
const titleVariants = cva(
99
"group-hover/link:underline group-focus/link:underline",
@@ -20,11 +20,10 @@ const titleVariants = cva(
2020
}
2121
)
2222

23-
type CardProps = React.HTMLAttributes<HTMLDivElement> & {
24-
href?: string
25-
}
23+
type CardProps = React.HTMLAttributes<HTMLDivElement> &
24+
Pick<LinkProps, "href" | "customEventOptions">
2625
const Card = React.forwardRef<HTMLDivElement, CardProps>(
27-
({ className, href, ...props }, ref) => {
26+
({ className, href, customEventOptions, ...props }, ref) => {
2827
if (href) {
2928
return (
3029
<BaseLink
@@ -33,6 +32,7 @@ const Card = React.forwardRef<HTMLDivElement, CardProps>(
3332
"group/link rounded-2xl text-body no-underline hover:text-body",
3433
className
3534
)}
35+
customEventOptions={customEventOptions}
3636
hideArrow
3737
>
3838
<div ref={ref} {...props} />

src/lib/interfaces.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,4 +181,5 @@ export interface ITitleCardItem {
181181
export interface CodeExample extends ITitleCardItem {
182182
codeLanguage: string
183183
code: string
184+
eventName: string
184185
}

0 commit comments

Comments
 (0)